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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public PostProduct toDomainEntity(PostProductJpaEntity jpaEntity) {
jpaEntity.getName(),
jpaEntity.getBrand(),
jpaEntity.getHashtags(),
jpaEntity.getRecommendedCount(),
jpaEntity.getCreatedAt(),
jpaEntity.getUpdatedAt());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -54,12 +61,14 @@ public static PostProductJpaEntity from(PostProduct postProduct, PostJpaEntity p
.name(postProduct.getName())
.brand(postProduct.getBrand())
.hashtags(postProduct.getHashtags())
.recommendedCount(postProduct.getRecommendedCount())
.build();
}

public void updatePostProductForDomainEntity(PostProduct postProduct) {
this.name = postProduct.getName();
this.brand = postProduct.getBrand();
this.hashtags = postProduct.getHashtags();
this.recommendedCount = postProduct.getRecommendedCount();
}
}
6 changes: 6 additions & 0 deletions src/main/java/com/ftm/server/domain/entity/PostProduct.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -29,13 +30,15 @@ private PostProduct(
String name,
String brand,
ProductHashtag[] hashtags,
Long recommendedCount,
LocalDateTime createdAt,
LocalDateTime updatedAt) {
this.id = id;
this.postId = postId;
this.name = name;
this.brand = brand;
this.hashtags = hashtags;
this.recommendedCount = recommendedCount;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
Expand All @@ -46,6 +49,7 @@ public static PostProduct of(
String name,
String brand,
ProductHashtag[] hashtags,
Long recommendedCount,
LocalDateTime createdAt,
LocalDateTime updatedAt) {
return PostProduct.builder()
Expand All @@ -54,6 +58,7 @@ public static PostProduct of(
.name(name)
.brand(brand)
.hashtags(hashtags)
.recommendedCount(recommendedCount)
.createdAt(createdAt)
.updatedAt(updatedAt)
.build();
Expand All @@ -65,6 +70,7 @@ public static PostProduct create(SavePostProductCommand command) {
.name(command.getName())
.brand(command.getBrand())
.hashtags(command.getHashtags())
.recommendedCount(0L)
.build();
}

Expand Down
Loading