From 3701bfa57800c1a29f6aa8bcf1c9d35ce4286cea Mon Sep 17 00:00:00 2001 From: minjikim Date: Tue, 19 Sep 2023 03:31:51 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20=EB=8C=93=EA=B8=80=20=EB=A6=AC=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20=EC=A0=95=EB=A0=AC?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/kr/co/preq/domain/board/service/BoardService.java | 2 +- .../kr/co/preq/domain/comment/repository/CommentRepository.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/kr/co/preq/domain/board/service/BoardService.java b/src/main/java/kr/co/preq/domain/board/service/BoardService.java index 4ccdcc0..9436df3 100644 --- a/src/main/java/kr/co/preq/domain/board/service/BoardService.java +++ b/src/main/java/kr/co/preq/domain/board/service/BoardService.java @@ -85,7 +85,7 @@ public BoardGetResponseDto getDetailBoard(Long boardId) { board.updateViews(views); List results = new ArrayList<>(); - List comments = commentRepository.findByBoardId(boardId); + List comments = commentRepository.findByBoardIdOrderByCreatedAt(boardId); comments.forEach(comment -> { results.add(CommentResponseDto.of(comment.getId(), comment.getMember().getName(), comment.getContent())); diff --git a/src/main/java/kr/co/preq/domain/comment/repository/CommentRepository.java b/src/main/java/kr/co/preq/domain/comment/repository/CommentRepository.java index 96911d4..dec3266 100644 --- a/src/main/java/kr/co/preq/domain/comment/repository/CommentRepository.java +++ b/src/main/java/kr/co/preq/domain/comment/repository/CommentRepository.java @@ -6,5 +6,5 @@ import java.util.List; public interface CommentRepository extends JpaRepository { - List findByBoardId(Long boardId); + List findByBoardIdOrderByCreatedAt(Long boardId); }