Skip to content

Commit

Permalink
HOTFIX: post 생성시 0으로 초기화
Browse files Browse the repository at this point in the history
  • Loading branch information
hyxklee committed Nov 11, 2024
1 parent 9ec86be commit fab2a6f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/leets/X/domain/post/domain/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public class Post extends BaseTimeEntity {
@Column(name = "like_count")
private Long likeCount = 0L; // 기본값을 0L로 초기화하여 null을 방지

@PrePersist
public void init() {
replyCount = 0L;
repostCount = 0L;
likeCount = 0L;
}

public void updateLikeCount(long newLikeCount) {
this.likeCount = newLikeCount;
}
Expand Down

0 comments on commit fab2a6f

Please sign in to comment.