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) {