Skip to content

Commit

Permalink
feat : 최신순으로 정렬
Browse files Browse the repository at this point in the history
  • Loading branch information
seokho-1116 committed Jul 25, 2024
1 parent 07fc4e6 commit 61cff96
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package site.timecapsulearchive.core.domain.announcement.service;

import java.util.Comparator;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -13,6 +14,10 @@ public class AnnouncementService {
private final AnnouncementRepository announcementRepository;

public List<AnnouncementDto> findAll() {
return announcementRepository.findAll();
List<AnnouncementDto> announcements = announcementRepository.findAll();

announcements.sort(Comparator.comparing(AnnouncementDto::createdAt).reversed());

return announcements;
}
}

0 comments on commit 61cff96

Please sign in to comment.