Skip to content

Commit

Permalink
Merge pull request #118 from pre-Q/fix/#117-get-board-detail-commets-…
Browse files Browse the repository at this point in the history
…sort

[Fix] 댓글 리스트 조회 시 정렬 추가
  • Loading branch information
Lightieey committed Sep 18, 2023
2 parents 9fbf00e + 3701bfa commit 8a22ca5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public BoardGetResponseDto getDetailBoard(Long boardId) {
board.updateViews(views);

List<CommentResponseDto> results = new ArrayList<>();
List<Comment> comments = commentRepository.findByBoardId(boardId);
List<Comment> comments = commentRepository.findByBoardIdOrderByCreatedAt(boardId);

comments.forEach(comment -> {
results.add(CommentResponseDto.of(comment.getId(), comment.getMember().getName(), comment.getContent()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
import java.util.List;

public interface CommentRepository extends JpaRepository<Comment, Long> {
List<Comment> findByBoardId(Long boardId);
List<Comment> findByBoardIdOrderByCreatedAt(Long boardId);
}

0 comments on commit 8a22ca5

Please sign in to comment.