Skip to content

Commit

Permalink
[Update]: 알림 리스트 최신순으로 반환
Browse files Browse the repository at this point in the history
Related to: #134
  • Loading branch information
dev-Crayon committed May 10, 2024
1 parent d254cda commit 47c5dd4
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

@Service
Expand All @@ -47,6 +49,8 @@ public NoticeResponse getList(Long userId) {
User user = UserServiceUtil.findUserById(userRepository, userId);

List<NoticeInfo> noticeList = noticeQueryRepository.getNoticeList(userId);
Comparator<NoticeInfo> compareByCreatedAt = Comparator.comparing(NoticeInfo::createdAt).reversed();
noticeList.sort(compareByCreatedAt);

return NoticeResponse.builder()
.username(user.getUsername())
Expand Down

0 comments on commit 47c5dd4

Please sign in to comment.