Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/ject/componote/domain/design/domain/Design.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private Design(final DesignSummary summary) {
this.bookmarkCount = Count.create();
}

public static Design of(final String name, final String organization, final String description, final BaseImage thumbnail) {
return new Design(DesignSummary.of(name, organization, description, thumbnail));
public static Design of(final String name, final String organization, final String description, final BaseImage thumbnail, final Count recommendCount) {
return new Design(DesignSummary.of(name, organization, description, thumbnail, recommendCount));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import jakarta.persistence.Convert;
import jakarta.persistence.Embeddable;
import ject.componote.domain.common.model.BaseImage;
import ject.componote.domain.common.model.Count;
import ject.componote.domain.common.model.converter.BaseImageConverter;
import ject.componote.domain.common.model.converter.CountConverter;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -28,14 +30,19 @@ public class DesignSummary {
@Column(name = "thumbnail", nullable = false)
private BaseImage thumbnail;

private DesignSummary(final String name, final String organization, final String description, final BaseImage thumbnail) {
@Convert(converter = CountConverter.class)
@Column(name = "recommendCount", nullable = false)
private Count recommendCount;

private DesignSummary(final String name, final String organization, final String description, final BaseImage thumbnail, final Count recommendCount) {
this.name = name;
this.organization = organization;
this.description = description;
this.thumbnail = thumbnail;
this.recommendCount = recommendCount;
}

public static DesignSummary of(final String name, final String organization, final String description, final BaseImage thumbnail) {
return new DesignSummary(name, organization, description, thumbnail);
public static DesignSummary of(final String name, final String organization, final String description, final BaseImage thumbnail, final Count recommendCount) {
return new DesignSummary(name, organization, description, thumbnail, recommendCount);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ject.componote.domain.design.dto.search.response;

import ject.componote.domain.common.model.Count;
import ject.componote.domain.design.domain.DesignSystem;

import java.util.List;
Expand All @@ -10,7 +11,8 @@ public record DesignSystemSearchResponse(
String organizationName,
String description,
List<DesignFilterSearchResponse> filters,
List<DesignLinkResponse> links
List<DesignLinkResponse> links,
Long recommendCount
) {
public static DesignSystemSearchResponse from(DesignSystem designSystem) {
return new DesignSystemSearchResponse(
Expand All @@ -21,12 +23,13 @@ public static DesignSystemSearchResponse from(DesignSystem designSystem) {
.map(filter -> new DesignFilterSearchResponse(filter.getType().name(), List.of(filter.getValue())))
.collect(Collectors.toList()),
designSystem.getLinks().getLinks().stream()
.filter(link -> link.getUrl() != null) // ✅ URL이 null이 아닌 경우만 처리
.filter(link -> link.getUrl() != null)
.map(link -> new DesignLinkResponse(
link.getType().name().toLowerCase(),
link.getUrl().getValue() // ✅ null이면 빈 문자열 처리
link.getUrl().getValue()
))
.collect(Collectors.toList())
.collect(Collectors.toList()),
designSystem.getDesign().getSummary().getRecommendCount().getValue()
);
}

Expand Down