feat: joinroom 수정

This commit is contained in:
박정민 2024-08-05 16:33:53 +09:00
parent 285e19dc89
commit 1a7e6c1bba
3 changed files with 8 additions and 7 deletions

View File

@ -237,9 +237,7 @@ public class LectureServiceImpl implements LectureService {
Lecture l; Lecture l;
l = lecture.get(); l = lecture.get();
if (l.isOnline()) { if (l.isOnline() == false) {
l.setOnline(false);
} else {
l.setOnline(true); l.setOnline(true);
} }

View File

@ -121,13 +121,16 @@ public class Controller {
@PostMapping(value = "/makeroom/{lecture_id}") @PostMapping(value = "/makeroom/{lecture_id}")
public ResponseEntity<Map<String, String>> makeRoom(@PathVariable("lecture_id") Long id, HttpServletRequest request) throws Exception { public ResponseEntity<Map<String, String>> makeRoom(@PathVariable("lecture_id") Long id, HttpServletRequest request) throws Exception {
String userToken = request.getHeader("Authorization"); String userToken = request.getHeader("Authorization");
Long userId = Long.parseLong(jwtUtil.getUserId(userToken)); Long userId = Long.parseLong(jwtUtil.getUserId(userToken));
User findUser = userRepository.findById(userId).orElse(null);
if (findUser.getRole() == UserRole.ADMIN) {
videoSertvice.startOnline(userId, id);
videoSertvice.startOnline(userId, id);
}
return ResponseEntity.ok(Map.of("token", " ")); return ResponseEntity.ok(Map.of("token", " "));

View File

@ -36,7 +36,7 @@ public class VideoServiceImpl implements VideoSertvice {
public boolean isRoomAccessible(Long lectureId, Long userId) { public boolean isRoomAccessible(Long lectureId, Long userId) {
LectureDetailResponse lecture = lectureService.findLectureById(userId, userId); LectureDetailResponse lecture = lectureService.findLectureById(userId, lectureId);
RegistrationStatus registrationStatus = registrationService.getStatus(userId, lectureId); RegistrationStatus registrationStatus = registrationService.getStatus(userId, lectureId);