-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Feature] 인기 있는 토론방 조회 API 및 최근 의견이 달린 토론방 API 구현 #85
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 👍
궁금한 점이 있어 코멘트 남겼으니 확인 부탁드립니다!!
Comment comment1 = Comment.builder() | ||
.content("의견") | ||
.user(user) | ||
.talkRoom(talkRooms.get(3)) | ||
.build(); | ||
Comment comment2 = Comment.builder() | ||
.content("의견") | ||
.user(user) | ||
.talkRoom(talkRooms.get(4)) | ||
.build(); | ||
Comment comment3 = Comment.builder() | ||
.content("의견") | ||
.user(user) | ||
.talkRoom(talkRooms.get(5)) | ||
.build(); | ||
Comment comment4 = Comment.builder() | ||
.content("의견 추가") | ||
.user(user) | ||
.talkRoom(talkRooms.get(5)) | ||
.build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment 생성 메서드가 있는데 builder
를 사용해서 객체를 생성하신 이유가 있나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
생성 메서드는 TalkRoom 0번 객체에만 만들어지기 때문에 여러 TalkRoom방에 Comment를 생성하기 위해 이렇게 작성했습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment comment1 = createComment(talkRooms.get(3), user);
Comment comment2 = createComment(talkRooms.get(4), user);
Comment comment3 = createComment(talkRooms.get(5), user);
Comment comment4 = createcomment(talkRooms.get(5), user);
commentRepository.saveAll(List.of(comment1, comment2, comment3, comment4));
위와 같이 작성하면 되지 않을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 수정 해서 다시 올렸습니다!
return talkRoom.createDateTime.desc(); | ||
} else if (RECOMMEND.equals(orderType)) { | ||
return talkRoomLike.count().desc(); | ||
} else if (RECENT_COMMENT.equals(orderType)) { | ||
return comment.createDateTime.max().desc(); | ||
} | ||
return OrderByNull.DEFAULT; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orderType
이 RECENT_COMMENT
일 때 max
로 정렬 조건을 지정한 이유가 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max
를 사용하지 않고 gropBy
를 TalkRoom.id 로 하니 에러가 발생하더라구요. 그래서 gropBy
를 없애고 comment.createDateTime.max().desc()
해결이 되어서 일단은 이렇게 작성해놨습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 알겠습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인 했습니다. 고생하셨습니다 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다 !
수고하셨습니다. 👍
💡 연관된 이슈
close #83
📝 작업 내용
💬 리뷰 요구 사항
Redis를 이용한 실시간 인기 있는 토론방 조회는 추후에 추가하는걸로 요구 사항이 변경되어 일단은 좋아요 높은 순으로 조회되는걸로 구현했습니다.