From dc9a6ac3b846748da3ee7138546f7fb5657e4ce2 Mon Sep 17 00:00:00 2001 From: kgc9007 Date: Mon, 29 Jul 2024 11:35:21 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Lecture=20=EB=B9=88=20=EB=AA=A9=EB=A1=9D?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=EC=8B=9C=20=EB=B0=98=ED=99=98=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lecture/controller/LectureController.java | 17 ----------------- .../lecture/service/LectureServiceImpl.java | 8 +------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java b/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java index e97cb07..6e04639 100644 --- a/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java +++ b/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java @@ -14,10 +14,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import java.io.File; -import java.io.IOException; import java.util.List; -import java.util.UUID; @RestController @RequestMapping("/lecture") @@ -69,10 +66,6 @@ public class LectureController { public ResponseEntity findAllLecture() { List lectures = lectureService.findAllLecture(); - if (lectures.isEmpty()) { - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - return new ResponseEntity<>(lectures, HttpStatus.OK); } @@ -83,14 +76,8 @@ public class LectureController { if (accessToken != null) { userId = Long.parseLong(jwtUtil.getUserId(accessToken)); } - LectureDetailResponse lectureDetailResponse = lectureService.findLectureById(userId, lectureId); - if (lectureDetailResponse == null) { - return new ResponseEntity<>(HttpStatus.OK); - } - - return new ResponseEntity<>(lectureDetailResponse, HttpStatus.OK); } @@ -104,10 +91,6 @@ public class LectureController { List myLectures = lectureService.findMyLecture(userId); - if (myLectures.isEmpty()) { - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - return new ResponseEntity<>(myLectures, HttpStatus.OK); } } 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 e644018..babbea5 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 @@ -18,10 +18,7 @@ import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.UUID; +import java.util.*; @Builder @Service @@ -119,7 +116,6 @@ public class LectureServiceImpl implements LectureService { @Override public List findAllLecture() { List lectureList = lectureRepository.findAll(); - System.out.println(lectureList.size()); List lectureSearchResponseList = new ArrayList<>(); for (Lecture lecture : lectureList) { @@ -137,11 +133,9 @@ public class LectureServiceImpl implements LectureService { @Override public LectureDetailResponse findLectureById(Long userId, long lectureId) { Optional lecture = lectureRepository.findById(lectureId); - if (lecture.isEmpty()) { return null; } - lecture = Optional.of(lecture.get()); String userStatus; if (userId == null) {