Skip to content

Commit

Permalink
fix: 댓글 시간순 정렬
Browse files Browse the repository at this point in the history
  • Loading branch information
u-genuine committed Jan 26, 2025
1 parent aa787ac commit ce3ce96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@ public Comment findComment(Long commentId){
}

public List<CommentDto> findComments(Long postId){
List<Comment> comments = commentRepository.findAllByPostId(postId);
List<CommentDto> commentDtos = comments.stream()
.map(CommentDto::from)
.toList();

return commentDtos;
}

public List<CommentDto> findChildComments(Long parentId){
List<Comment> comments = commentRepository.findAllByParentId(parentId);
List<Comment> comments = commentRepository.findAllByPostIdOrderByCreatedTimeAsc(postId);
List<CommentDto> commentDtos = comments.stream()
.map(CommentDto::from)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {

boolean existsByParentId(Long parentId);

List<Comment> findAllByPostId(Long postId);

List<Comment> findAllByParentId(Long parentId);
List<Comment> findAllByPostIdOrderByCreatedTimeAsc(Long postId);

Slice<Comment> findAllByUserId(Long userId, Pageable pageable);
}

0 comments on commit ce3ce96

Please sign in to comment.