From 752cb96cba945aafc9dc7895cdb46389ddf82896 Mon Sep 17 00:00:00 2001 From: Nakji Date: Sun, 2 Mar 2025 00:01:44 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EB=8C=93=EA=B8=80=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=88=9C=EC=84=9C=20=EC=98=A4=EB=A6=84=EC=B0=A8?= =?UTF-8?q?=EC=88=9C=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/swyp8team2/comment/domain/CommentRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/swyp8team2/comment/domain/CommentRepository.java b/src/main/java/com/swyp8team2/comment/domain/CommentRepository.java index 54e0f7e6..0dfbfbb9 100644 --- a/src/main/java/com/swyp8team2/comment/domain/CommentRepository.java +++ b/src/main/java/com/swyp8team2/comment/domain/CommentRepository.java @@ -14,8 +14,8 @@ public interface CommentRepository extends JpaRepository { SELECT c FROM Comment c WHERE c.postId = :postId - AND (:cursor is null or c.id < :cursor) - ORDER BY c.createdAt DESC + AND (:cursor is null or c.id > :cursor) + ORDER BY c.createdAt ASC """) Slice findByPostId( @Param("postId") Long postId, From 7bf2d416709b39e8f342aa0f7f7a41cc4cfd1b01 Mon Sep 17 00:00:00 2001 From: Nakji Date: Sun, 2 Mar 2025 00:06:40 +0900 Subject: [PATCH 2/2] =?UTF-8?q?test:=20=EB=8C=93=EA=B8=80=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/swyp8team2/comment/domain/CommentRepositoryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/swyp8team2/comment/domain/CommentRepositoryTest.java b/src/test/java/com/swyp8team2/comment/domain/CommentRepositoryTest.java index d8a44e7d..aaa6f9ca 100644 --- a/src/test/java/com/swyp8team2/comment/domain/CommentRepositoryTest.java +++ b/src/test/java/com/swyp8team2/comment/domain/CommentRepositoryTest.java @@ -35,6 +35,6 @@ void select_CommentUser() { Slice result2 = commentRepository.findByPostId(1L, 1L, PageRequest.of(0, 10)); // then2 - assertThat(result2.getContent()).hasSize(0); + assertThat(result2.getContent()).hasSize(2); } } \ No newline at end of file