Merge pull request #131 from TeamBNBN/be/Lecture
fix: Lecture 빈 목록 조회시 반환 타입 수정
This commit is contained in:
commit
ace52afb55
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user