From 4e047998a8e25c0b29963f73247106c3fd50647e Mon Sep 17 00:00:00 2001 From: Dayeon-Hong Date: Tue, 28 May 2024 16:22:02 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EC=9D=BC=EC=A0=95=EC=9D=B4=201?= =?UTF-8?q?=EA=B0=9C=EB=8F=84=20=EC=97=86=EB=8A=94=20=EC=9C=A0=EC=A0=80?= =?UTF-8?q?=EC=97=90=EA=B2=8C=20=EC=98=A4=EB=A5=98=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/schedule/service/ScheduleServiceImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/com/isp/backend/domain/schedule/service/ScheduleServiceImpl.java b/backend/src/main/java/com/isp/backend/domain/schedule/service/ScheduleServiceImpl.java index 4baf26f5..6e04983b 100644 --- a/backend/src/main/java/com/isp/backend/domain/schedule/service/ScheduleServiceImpl.java +++ b/backend/src/main/java/com/isp/backend/domain/schedule/service/ScheduleServiceImpl.java @@ -23,10 +23,7 @@ import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Optional; +import java.util.*; import java.util.stream.Collectors; @Slf4j @@ -202,7 +199,11 @@ public Country validateCountry(String countryName) { @Override public List getLatestCreatedSchedules(String uid, int limit) { Member findMember = validateUserCheck(uid); - List topSchedules = scheduleRepository.findTop5ByMemberOrderByIdDesc(findMember); + List topSchedules = scheduleRepository.findTop5ByMemberOrderByIdDescWithDetails(findMember); + + if (topSchedules.isEmpty()) { + throw new ScheduleNotFoundException(); + } List responses = new ArrayList<>(); for (Schedule schedule : topSchedules) {