Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] commentCount add in BoothDetail #11

Merged
merged 1 commit into from
May 20, 2024
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 @@ -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
Loading