From 65da5bc657d32c1716f98b1cfce94c8c1e14d8b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=9B=90=EA=B2=BD?= Date: Wed, 11 Dec 2024 10:27:47 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A4=91=EB=B3=B5=EB=90=9C=20=EC=97=AC?= =?UTF-8?q?=EB=9F=AC=EA=B0=9C=EC=9D=98=20lecture=5Fid=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/TimetableLectureRepositoryV2.java | 7 +------ .../timetableV2/service/TimetableLectureService.java | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/in/koreatech/koin/domain/timetableV2/repository/TimetableLectureRepositoryV2.java b/src/main/java/in/koreatech/koin/domain/timetableV2/repository/TimetableLectureRepositoryV2.java index 2bc845d12..60161cf51 100644 --- a/src/main/java/in/koreatech/koin/domain/timetableV2/repository/TimetableLectureRepositoryV2.java +++ b/src/main/java/in/koreatech/koin/domain/timetableV2/repository/TimetableLectureRepositoryV2.java @@ -26,12 +26,7 @@ default TimetableLecture getById(Integer id) { TimetableLecture save(TimetableLecture timetableLecture); - Optional findByTimetableFrameIdAndLectureId(Integer frameId, Integer lectureId); - - default TimetableLecture getByFrameIdAndLectureId(Integer frameId, Integer lectureId) { - return findByTimetableFrameIdAndLectureId(frameId, lectureId) - .orElseThrow(() -> TimetableLectureNotFoundException.withDetail("frameId: " + frameId + ", lectureId: " + lectureId)); - } + List findAllByTimetableFrameIdAndLectureId(Integer frameId, Integer lectureId); @Query(value = "SELECT * FROM timetable_lecture WHERE id = :id", nativeQuery = true) Optional findByIdWithDeleted(@Param("id") Integer id); diff --git a/src/main/java/in/koreatech/koin/domain/timetableV2/service/TimetableLectureService.java b/src/main/java/in/koreatech/koin/domain/timetableV2/service/TimetableLectureService.java index b1120cc08..90773daa1 100644 --- a/src/main/java/in/koreatech/koin/domain/timetableV2/service/TimetableLectureService.java +++ b/src/main/java/in/koreatech/koin/domain/timetableV2/service/TimetableLectureService.java @@ -82,8 +82,7 @@ public void deleteTimetableLectures(List request, Integer userId) { public void deleteTimetableLectureByFrameId(Integer frameId, Integer lectureId, Integer userId) { TimetableFrame frame = timetableFrameRepositoryV2.getById(frameId); validateUserAuthorization(frame.getUser().getId(), userId); - TimetableLecture timetableLecture = timetableLectureRepositoryV2.getByFrameIdAndLectureId(frameId, lectureId); - timetableLecture.delete(); + timetableLectureRepositoryV2.findAllByTimetableFrameIdAndLectureId(frameId, lectureId).forEach(TimetableLecture::delete); } @Transactional