From 4ea2da5b9a7195229e9e9ff3813244cb585e3212 Mon Sep 17 00:00:00 2001 From: myqewr Date: Sun, 17 Aug 2025 17:32:56 +0900 Subject: [PATCH] =?UTF-8?q?[refactor]=20:=20post=5Fproduct=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=20=EC=B6=94=EC=B2=9C=EC=88=98=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80(#150)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../out/persistence/mapper/PostProductMapper.java | 1 + .../out/persistence/model/PostProductJpaEntity.java | 11 ++++++++++- .../com/ftm/server/domain/entity/PostProduct.java | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) 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(); }