diff --git a/src/main/java/com/ftm/server/adapter/out/persistence/mapper/PostProductMapper.java b/src/main/java/com/ftm/server/adapter/out/persistence/mapper/PostProductMapper.java index 09859dc..bc3c4e6 100644 --- a/src/main/java/com/ftm/server/adapter/out/persistence/mapper/PostProductMapper.java +++ b/src/main/java/com/ftm/server/adapter/out/persistence/mapper/PostProductMapper.java @@ -15,6 +15,7 @@ public PostProduct toDomainEntity(PostProductJpaEntity jpaEntity) { jpaEntity.getName(), jpaEntity.getBrand(), jpaEntity.getHashtags(), + jpaEntity.getRecommendedCount(), jpaEntity.getCreatedAt(), jpaEntity.getUpdatedAt()); } diff --git a/src/main/java/com/ftm/server/adapter/out/persistence/model/PostProductJpaEntity.java b/src/main/java/com/ftm/server/adapter/out/persistence/model/PostProductJpaEntity.java index 3316b81..e9c1b67 100644 --- a/src/main/java/com/ftm/server/adapter/out/persistence/model/PostProductJpaEntity.java +++ b/src/main/java/com/ftm/server/adapter/out/persistence/model/PostProductJpaEntity.java @@ -39,13 +39,20 @@ public class PostProductJpaEntity extends BaseTimeJpaEntity { @Column(name = "hashtags", columnDefinition = "product_hashtag[]") private ProductHashtag[] hashtags; + private Long recommendedCount; + @Builder(access = AccessLevel.PRIVATE) private PostProductJpaEntity( - PostJpaEntity post, String name, String brand, ProductHashtag[] hashtags) { + PostJpaEntity post, + String name, + String brand, + ProductHashtag[] hashtags, + Long recommendedCount) { this.post = post; this.name = name; this.brand = brand; this.hashtags = hashtags; + this.recommendedCount = recommendedCount; } public static PostProductJpaEntity from(PostProduct postProduct, PostJpaEntity postJpaEntity) { @@ -54,6 +61,7 @@ public static PostProductJpaEntity from(PostProduct postProduct, PostJpaEntity p .name(postProduct.getName()) .brand(postProduct.getBrand()) .hashtags(postProduct.getHashtags()) + .recommendedCount(postProduct.getRecommendedCount()) .build(); } @@ -61,5 +69,6 @@ public void updatePostProductForDomainEntity(PostProduct postProduct) { this.name = postProduct.getName(); this.brand = postProduct.getBrand(); this.hashtags = postProduct.getHashtags(); + this.recommendedCount = postProduct.getRecommendedCount(); } } diff --git a/src/main/java/com/ftm/server/domain/entity/PostProduct.java b/src/main/java/com/ftm/server/domain/entity/PostProduct.java index a5c1d0f..76a6ccc 100644 --- a/src/main/java/com/ftm/server/domain/entity/PostProduct.java +++ b/src/main/java/com/ftm/server/domain/entity/PostProduct.java @@ -21,6 +21,7 @@ public class PostProduct extends BaseTime { private String name; private String brand; private ProductHashtag[] hashtags; + private Long recommendedCount; @Builder(access = AccessLevel.PRIVATE) private PostProduct( @@ -29,6 +30,7 @@ private PostProduct( String name, String brand, ProductHashtag[] hashtags, + Long recommendedCount, LocalDateTime createdAt, LocalDateTime updatedAt) { this.id = id; @@ -36,6 +38,7 @@ private PostProduct( this.name = name; this.brand = brand; this.hashtags = hashtags; + this.recommendedCount = recommendedCount; this.createdAt = createdAt; this.updatedAt = updatedAt; } @@ -46,6 +49,7 @@ public static PostProduct of( String name, String brand, ProductHashtag[] hashtags, + Long recommendedCount, LocalDateTime createdAt, LocalDateTime updatedAt) { return PostProduct.builder() @@ -54,6 +58,7 @@ public static PostProduct of( .name(name) .brand(brand) .hashtags(hashtags) + .recommendedCount(recommendedCount) .createdAt(createdAt) .updatedAt(updatedAt) .build(); @@ -65,6 +70,7 @@ public static PostProduct create(SavePostProductCommand command) { .name(command.getName()) .brand(command.getBrand()) .hashtags(command.getHashtags()) + .recommendedCount(0L) .build(); }