diff --git a/src/main/java/ject/componote/domain/design/domain/Design.java b/src/main/java/ject/componote/domain/design/domain/Design.java index 2facd971..e32999cc 100644 --- a/src/main/java/ject/componote/domain/design/domain/Design.java +++ b/src/main/java/ject/componote/domain/design/domain/Design.java @@ -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)); } } diff --git a/src/main/java/ject/componote/domain/design/domain/summary/DesignSummary.java b/src/main/java/ject/componote/domain/design/domain/summary/DesignSummary.java index b2d42de5..e192d2b2 100644 --- a/src/main/java/ject/componote/domain/design/domain/summary/DesignSummary.java +++ b/src/main/java/ject/componote/domain/design/domain/summary/DesignSummary.java @@ -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; @@ -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); } } diff --git a/src/main/java/ject/componote/domain/design/dto/search/response/DesignSystemSearchResponse.java b/src/main/java/ject/componote/domain/design/dto/search/response/DesignSystemSearchResponse.java index c93e0313..b4b58392 100644 --- a/src/main/java/ject/componote/domain/design/dto/search/response/DesignSystemSearchResponse.java +++ b/src/main/java/ject/componote/domain/design/dto/search/response/DesignSystemSearchResponse.java @@ -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; @@ -10,7 +11,8 @@ public record DesignSystemSearchResponse( String organizationName, String description, List filters, - List links + List links, + Long recommendCount ) { public static DesignSystemSearchResponse from(DesignSystem designSystem) { return new DesignSystemSearchResponse( @@ -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() ); }