fix: Lecture 빈 목록 조회시 반환 타입 수정

This commit is contained in:
kgc9007 2024-07-29 11:35:21 +09:00
parent 2d88ceed34
commit dc9a6ac3b8
2 changed files with 1 additions and 24 deletions

View File

@ -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<LectureSearchResponse> 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<LectureSearchResponse> myLectures = lectureService.findMyLecture(userId);
if (myLectures.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
return new ResponseEntity<>(myLectures, HttpStatus.OK);
}
}

View File

@ -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<LectureSearchResponse> findAllLecture() {
List<Lecture> lectureList = lectureRepository.findAll();
System.out.println(lectureList.size());
List<LectureSearchResponse> 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> lecture = lectureRepository.findById(lectureId);
if (lecture.isEmpty()) {
return null;
}
lecture = Optional.of(lecture.get());
String userStatus;
if (userId == null) {