Skip to content

Commit d2a8fb6

Browse files
authored
Merge pull request #222 from TeamLearningFlow/feat/191/modify
feat : 마이페이지 최근 학습 컬렉션 조회시 정렬 기준 UpdatedAt 기준으로 내림차순 정렬로 변경
2 parents 9f5e187 + d9362f8 commit d2a8fb6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/learningFlow/learningFlow_BE/repository/UserCollectionRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
public interface UserCollectionRepository extends JpaRepository<UserCollection, Long> {
1616
Optional<UserCollection> findByUserAndCollection(User user, Collection collection);
17-
List<UserCollection> findByUserAndStatusOrderByCompletedTimeDesc(User user, UserCollectionStatus status);
17+
List<UserCollection> findByUserAndStatusOrderByUpdatedAtDesc(User user, UserCollectionStatus status);
1818
Optional<UserCollection> findFirstByUserAndStatusOrderByUpdatedAtDesc(User user, UserCollectionStatus status);
1919

2020
@Modifying

src/main/java/learningFlow/learningFlow_BE/service/user/UserService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public UserResponseDTO.UserMyPageResponseDTO getUserMyPageResponseDTO(String log
214214
.orElseThrow(() -> new UserHandler(ErrorStatus.USER_NOT_FOUND));
215215

216216
List<UserCollection> inProgressUserCollectionList
217-
= userCollectionRepository.findByUserAndStatusOrderByCompletedTimeDesc(user, UserCollectionStatus.IN_PROGRESS);
217+
= userCollectionRepository.findByUserAndStatusOrderByUpdatedAtDesc(user, UserCollectionStatus.IN_PROGRESS);
218218

219219
List<ResourceResponseDTO.RecentlyWatchedEpisodeDTO> recentlyWatchedEpisodeDTOList = inProgressUserCollectionList.stream()
220220
.map(userCollection -> {
@@ -237,7 +237,7 @@ public UserResponseDTO.UserMyPageResponseDTO getUserMyPageResponseDTO(String log
237237

238238

239239
List<UserCollection> completedUserCollectionList
240-
= userCollectionRepository.findByUserAndStatusOrderByCompletedTimeDesc(user, UserCollectionStatus.COMPLETED);
240+
= userCollectionRepository.findByUserAndStatusOrderByUpdatedAtDesc(user, UserCollectionStatus.COMPLETED);
241241

242242
List<CollectionResponseDTO.CollectionPreviewDTO> completedCollectionList = completedUserCollectionList.stream()
243243
.map(userCollection -> {

0 commit comments

Comments
 (0)