From 8ccecf66c2c8912236662eae22e6bdaec586b9e5 Mon Sep 17 00:00:00 2001 From: yb__char Date: Tue, 21 May 2024 11:57:25 +0900 Subject: [PATCH] fix: feed order by desc --- .../com/depromeet/domain/feed/application/FeedService.java | 1 - .../domain/missionRecord/dao/MissionRecordRepositoryImpl.java | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/depromeet/domain/feed/application/FeedService.java b/src/main/java/com/depromeet/domain/feed/application/FeedService.java index 127274ce..d713aad8 100644 --- a/src/main/java/com/depromeet/domain/feed/application/FeedService.java +++ b/src/main/java/com/depromeet/domain/feed/application/FeedService.java @@ -94,7 +94,6 @@ public FeedSliceResponse findAllFeed(int size, Long lastId) { public FeedSliceResponse findFollowerFeed(int size, Long lastId) { final Member currentMember = memberUtil.getCurrentMember(); List sourceMembers = getSourceMembers(currentMember.getId()); - System.out.println(sourceMembers.size()); Slice feedAllByPage = missionRecordRepository.findFeedAllByPage(size, lastId, sourceMembers); diff --git a/src/main/java/com/depromeet/domain/missionRecord/dao/MissionRecordRepositoryImpl.java b/src/main/java/com/depromeet/domain/missionRecord/dao/MissionRecordRepositoryImpl.java index fc3925f5..a869b973 100644 --- a/src/main/java/com/depromeet/domain/missionRecord/dao/MissionRecordRepositoryImpl.java +++ b/src/main/java/com/depromeet/domain/missionRecord/dao/MissionRecordRepositoryImpl.java @@ -39,7 +39,7 @@ public List findAllByMissionIdAndYearMonth(Long missionId, YearMo missionIdEq(missionId), yearEq(yearMonth.getYear()), monthEq(yearMonth.getMonthValue())) - .orderBy(missionRecord.startedAt.asc()) + .orderBy(missionRecord.finishedAt.desc()) .fetch(); } @@ -181,6 +181,7 @@ public Slice findAllFetch(int size, Long lastId) { .fetchJoin() .distinct() .where(ltMissionRecordId(lastId)) + .orderBy(missionRecord.finishedAt.desc()) .limit((long) size + 1) .fetch(); @@ -204,6 +205,7 @@ public Slice findAllFetchByFollowings( ltMissionRecordId(lastId), missionRecord.mission.member.in(followingMembers)) .where(mission.visibility.in(List.of(ALL, FOLLOWER))) + .orderBy(missionRecord.finishedAt.desc()) .limit((long) size + 1) .fetch();