From 4ed8d30271de5758ac38e96554d8cf84de0e0435 Mon Sep 17 00:00:00 2001 From: HyeJiJUN Date: Tue, 5 Nov 2024 19:22:44 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=8A=B9=EC=A0=95=20=EC=B9=9C=EA=B5=AC?= =?UTF-8?q?=20=EC=9D=BC=EA=B8=B0=20=EC=A1=B0=ED=9A=8C=20=EC=B5=9C=EC=8B=A0?= =?UTF-8?q?=EC=88=9C=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/potatocake/everymoment/service/FriendService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/potatocake/everymoment/service/FriendService.java b/src/main/java/com/potatocake/everymoment/service/FriendService.java index f21dead..852e850 100644 --- a/src/main/java/com/potatocake/everymoment/service/FriendService.java +++ b/src/main/java/com/potatocake/everymoment/service/FriendService.java @@ -22,6 +22,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -49,10 +50,10 @@ public OneFriendDiariesResponse OneFriendDiariesResponse(Long memberid, Long fri friendRepository.findByMemberAndFriend(currentMember, friend) .orElseThrow(() -> new GlobalException(ErrorCode.FRIEND_NOT_FOUND)); - Pageable pageable = PageRequest.of(key, size); + Pageable pageable = PageRequest.of(key, size, Sort.by(Sort.Direction.DESC, "createAt")); Page diaries = diaryRepository.findAll( - DiarySpecification.filterDiaries(null, null, null, date, null, null, null) + FriendDiarySpecification.filterDiaries(null, null, null, date, null, null) .and((root, query, builder) -> builder.equal(root.get("member").get("id"), friendId)), pageable);