Skip to content

Commit

Permalink
Merge pull request #11 from LikeLion-KNU/HOTFIX
Browse files Browse the repository at this point in the history
[ADD] commentCount add in BoothDetail
  • Loading branch information
himodu authored May 20, 2024
2 parents a0f9d77 + 03e178e commit 94ddfe0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class BoothDetail {
private String host;
private String boothDescription;
private int likes;
private int commentCount;
private String categori;
private int boothnum;
private List<String> urls;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public class BoothEntity extends BasicEntity {
@Column(name="host")
private String host;

@Column(name="commentCount")
@ColumnDefault("0")
private int commentCount;

@OneToMany(mappedBy = "booth", fetch = FetchType.LAZY)
private List<CommentEntity> commentEntityList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public BoothDetail getBooth(int boothnum, String categori, String userHash) {
.host(booth.getHost())
.boothDescription(booth.getDescription())
.likes(booth.getLikes())
.commentCount(booth.getCommentCount())
.boothnum(booth.getBoothnum())
.categori(booth.getCategori())
.urls(booth.getUrls())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public Long postComment(int boothNum, String categori, CommentRequest commentReq
throw new NoExistException("해당 부스 정보가 없습니다. (카테고리, 부스번호 확인 요망)");
}else{
booth = boothOp.get();
booth.setCommentCount(booth.getCommentCount()+1);
}

CommentEntity newComment = Comment.toEntity(commentRequest, booth, user);
Expand Down

0 comments on commit 94ddfe0

Please sign in to comment.