feat: joinromm 수정:

This commit is contained in:
박정민 2024-08-05 16:16:14 +09:00
parent 2a090a3016
commit 77a5aed6ec
3 changed files with 27 additions and 7 deletions

View File

@ -95,7 +95,8 @@ public class Controller {
} else if (findUser.getRole() == UserRole.ADMIN) {//&& lecture.isOnline() ) { } else if (findUser.getRole() == UserRole.ADMIN) {//&& lecture.isOnline() ) {
// 자신의 강의인지 확인하기
if (videoSertvice.checkAdmin(userId, id)) {
IdentityData identityData = new IdentityData(participantName, "강사"); IdentityData identityData = new IdentityData(participantName, "강사");
String jsonIdentity = serializeIdentityData(identityData); String jsonIdentity = serializeIdentityData(identityData);
@ -107,6 +108,8 @@ public class Controller {
return ResponseEntity.ok(Map.of("token", token.toJwt())); return ResponseEntity.ok(Map.of("token", token.toJwt()));
}
} }

View File

@ -10,4 +10,6 @@ public interface VideoSertvice {
boolean isRoomAccessible(Long lectureId, Long userId); boolean isRoomAccessible(Long lectureId, Long userId);
boolean checkAdmin(Long userId, Long lectureId);
} }

View File

@ -2,6 +2,7 @@ package com.edufocus.edufocus.video.service;
import com.edufocus.edufocus.lecture.entity.Lecture; import com.edufocus.edufocus.lecture.entity.Lecture;
import com.edufocus.edufocus.lecture.entity.LectureDetailResponse; import com.edufocus.edufocus.lecture.entity.LectureDetailResponse;
import com.edufocus.edufocus.lecture.entity.LectureSearchResponse;
import com.edufocus.edufocus.lecture.service.LectureService; import com.edufocus.edufocus.lecture.service.LectureService;
import com.edufocus.edufocus.registration.entity.RegistrationStatus; import com.edufocus.edufocus.registration.entity.RegistrationStatus;
import com.edufocus.edufocus.registration.service.RegistrationService; import com.edufocus.edufocus.registration.service.RegistrationService;
@ -10,6 +11,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List;
@Service @Service
@Transactional @Transactional
@ -46,4 +48,17 @@ public class VideoServiceImpl implements VideoSertvice {
return false; return false;
} }
} }
@Override
public boolean checkAdmin(Long userId, Long lectureId) {
// 강의가 강의인지 확인
List<LectureSearchResponse> lecture = lectureService.findMyLecture(userId);
for (LectureSearchResponse l : lecture) {
if (l.getId() == lectureId) {
return true;
}
}
return false;
}
} }