Skip to content

Commit

Permalink
충돌해결
Browse files Browse the repository at this point in the history
  • Loading branch information
gouyeonch committed Sep 6, 2024
2 parents e082b39 + 8247931 commit 3c08892
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {
SELECT c FROM Comment c
WHERE c.news.id = :newsId
AND c.id < :cursorId
AND c.parent IS NULL
ORDER BY c.editedAt DESC, c.id DESC
""")
Page<Comment> findByNewsIdAndIdLessThanOrderByEditedAtDescGuest(
Expand All @@ -32,6 +33,7 @@ Page<Comment> findByNewsIdAndIdLessThanOrderByEditedAtDescGuest(
@Query("""
SELECT c FROM Comment c
WHERE c.news.id = :newsId
AND c.parent IS NULL
ORDER BY c.editedAt DESC, c.id DESC
""")
Page<Comment> findFirstPageByNewsIdOrderByEditedAtDescGuest(
Expand All @@ -46,6 +48,7 @@ Page<Comment> findFirstPageByNewsIdOrderByEditedAtDescGuest(
WHERE c.news.id = :newsId
AND c.id < :cursorId
AND hu.id IS NULL
AND c.parent IS NULL
ORDER BY c.editedAt DESC, c.id DESC
""")
Page<Comment> findByNewsIdAndIdLessThanOrderByEditedAtDesc(
Expand All @@ -61,6 +64,7 @@ Page<Comment> findByNewsIdAndIdLessThanOrderByEditedAtDesc(
LEFT JOIN HideUser hu ON hu.hidedUser = c.user AND hu.user = :user
WHERE c.news.id = :newsId
AND hu.id IS NULL
AND c.parent IS NULL
ORDER BY c.editedAt DESC, c.id DESC
""")
Page<Comment> findFirstPageByNewsIdOrderByEditedAtDesc(
Expand All @@ -79,6 +83,7 @@ Page<Comment> findFirstPageByNewsIdOrderByEditedAtDesc(
LEFT JOIN HideUser hu ON hu.hidedUser = c.user AND hu.user = :user
WHERE c.news.id = :newsId
AND hu.id IS NULL
AND c.parent IS NULL
GROUP BY c
HAVING (COUNT(children) * :replyWeight + COUNT(likes) * :likeWeight) < :cursorScore
OR ((COUNT(children) * :replyWeight + COUNT(likes) * :likeWeight) = :cursorScore AND c.id < :cursorId)
Expand All @@ -101,6 +106,7 @@ Page<Comment> findByNewsIdAndPopularityLessThan(
LEFT JOIN c.children children
LEFT JOIN HideUser hu ON hu.hidedUser = c.user AND hu.user = :user
WHERE c.news.id = :newsId
AND c.parent IS NULL
AND hu.id IS NULL
GROUP BY c
ORDER BY (COUNT(children) * :replyWeight + COUNT(likes) * :likeWeight) DESC, c.id DESC
Expand All @@ -119,6 +125,7 @@ Page<Comment> findFirstPageByNewsIdAndPopularity(
LEFT JOIN c.likes likes
LEFT JOIN c.children children
WHERE c.news.id = :newsId
AND c.parent IS NULL
GROUP BY c
HAVING (COUNT(children) * :replyWeight + COUNT(likes) * :likeWeight) < :cursorScore
OR ((COUNT(children) * :replyWeight + COUNT(likes) * :likeWeight) = :cursorScore AND c.id < :cursorId)
Expand All @@ -140,6 +147,7 @@ Page<Comment> findByNewsIdAndPopularityLessThanGuest(
LEFT JOIN c.likes likes
LEFT JOIN c.children children
WHERE c.news.id = :newsId
AND c.parent IS NULL
GROUP BY c
ORDER BY (COUNT(children) * :replyWeight + COUNT(likes) * :likeWeight) DESC, c.id DESC
""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ public CursorResponseDto<List<ReplyListDto>> readOldestReply(Long userId, Long p
.commentLikeCnt(commentLikeService.countByComment(reply))
.user(CommentSummoryDto.of(reply.getUser()))
.comment(CommentDto.of(reply))
.userLike(userLike)
.build()
);
}
Expand Down

0 comments on commit 3c08892

Please sign in to comment.