From 7fe5ec3b2bf932124d68488676a978316c12f81b Mon Sep 17 00:00:00 2001 From: kgc91747 Date: Mon, 12 Aug 2024 09:43:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20lecture=20=EA=B0=95=EC=9D=98=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=EC=8B=9C=20=EC=A0=80=EC=9E=A5=EC=86=8C?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=82=AC=EC=A7=84=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edufocus/lecture/service/LectureServiceImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/lecture/service/LectureServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/lecture/service/LectureServiceImpl.java index acddb48..1a3a572 100644 --- a/backend/src/main/java/com/edufocus/edufocus/lecture/service/LectureServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/lecture/service/LectureServiceImpl.java @@ -113,6 +113,12 @@ public class LectureServiceImpl implements LectureService { return false; } + String image = lecture.getImage(); + if (image != null) { + File file = new File(lecture.getImage()); + file.delete(); + } + lectureRepository.deleteById(lectureId); return true; } @@ -220,9 +226,9 @@ public class LectureServiceImpl implements LectureService { public int compare(LectureSearchResponse lsr1, LectureSearchResponse lsr2) { long lsr1Id = lsr1.getId(); long lsr2Id = lsr2.getId(); - if(lsr2Id > lsr1Id) + if (lsr2Id > lsr1Id) return 1; - else if(lsr2Id == lsr1Id) + else if (lsr2Id == lsr1Id) return 0; return -1; }