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 4257260..90da51c 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) {