Skip to content

Commit

Permalink
feat: 특정 친구 일기 조회 최신순으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
HyeJiJUN committed Nov 5, 2024
1 parent 7cad1f3 commit 4ed8d30
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Diary> 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);

Expand Down

0 comments on commit 4ed8d30

Please sign in to comment.