Merge branch 'backend' of https://lab.ssafy.com/s11-webmobile1-sub2/S11P12A701 into be/Quiz
This commit is contained in:
commit
525166776d
@ -22,14 +22,16 @@ public interface LectureService {
|
|||||||
List<LectureSearchResponse> findAllLecture();
|
List<LectureSearchResponse> findAllLecture();
|
||||||
|
|
||||||
String getUserStatus(Long userId, Lecture lecture);
|
String getUserStatus(Long userId, Lecture lecture);
|
||||||
|
|
||||||
LectureDetailResponse findLectureById(Long userId, long lectureId);
|
LectureDetailResponse findLectureById(Long userId, long lectureId);
|
||||||
|
|
||||||
List<LectureSearchResponse> findMyLecture(long userId);
|
List<LectureSearchResponse> findMyLecture(long userId);
|
||||||
|
|
||||||
Lecture findLectureByTitle(String title);
|
Lecture findLectureByTitle(String title);
|
||||||
|
|
||||||
void changeState(Long lectureId);
|
void startClass(Long lectureId);
|
||||||
|
|
||||||
|
void stopClass(Long lectureId);
|
||||||
|
|
||||||
boolean getState(Long lectureId);
|
boolean getState(Long lectureId);
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ public class LectureServiceImpl implements LectureService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changeState(Long id) {
|
public void startClass(Long id) {
|
||||||
|
|
||||||
Optional<Lecture> lecture = lectureRepository.findById(id);
|
Optional<Lecture> lecture = lectureRepository.findById(id);
|
||||||
|
|
||||||
@ -245,6 +245,26 @@ public class LectureServiceImpl implements LectureService {
|
|||||||
lectureRepository.save(l);
|
lectureRepository.save(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopClass(Long id) {
|
||||||
|
Optional<Lecture> lecture = lectureRepository.findById(id);
|
||||||
|
|
||||||
|
|
||||||
|
if (!lecture.isPresent()) {
|
||||||
|
throw new RuntimeException("Lecture not found with id: " + id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Lecture l;
|
||||||
|
l = lecture.get();
|
||||||
|
if (l.isOnline()) {
|
||||||
|
l.setOnline(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lectureRepository.save(l);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getState(Long lectureId) {
|
public boolean getState(Long lectureId) {
|
||||||
|
|
||||||
|
@ -136,6 +136,26 @@ public class Controller {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(value = "/deleteroom/{lecture_id}")
|
||||||
|
public ResponseEntity<Map<String, String>> deleteRooom(@PathVariable("lecture_id") Long id, HttpServletRequest request) throws Exception {
|
||||||
|
String userToken = request.getHeader("Authorization");
|
||||||
|
Long userId = Long.parseLong(jwtUtil.getUserId(userToken));
|
||||||
|
|
||||||
|
User findUser = userRepository.findById(userId).orElse(null);
|
||||||
|
if (findUser.getRole() == UserRole.ADMIN) {
|
||||||
|
|
||||||
|
|
||||||
|
videoSertvice.startOnline(userId, id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseEntity.ok(Map.of("token", " "));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(value = "/livekit/webhook", consumes = "application/webhook+json")
|
@PostMapping(value = "/livekit/webhook", consumes = "application/webhook+json")
|
||||||
public ResponseEntity<String> receiveWebhook(@RequestHeader("Authorization") String authHeader, @RequestBody String body) {
|
public ResponseEntity<String> receiveWebhook(@RequestHeader("Authorization") String authHeader, @RequestBody String body) {
|
||||||
WebhookReceiver webhookReceiver = new WebhookReceiver(LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
|
WebhookReceiver webhookReceiver = new WebhookReceiver(LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
|
||||||
|
@ -24,12 +24,12 @@ public class VideoServiceImpl implements VideoSertvice {
|
|||||||
@Override
|
@Override
|
||||||
public void startOnline(Long userId, Long lectureId) throws SQLException {
|
public void startOnline(Long userId, Long lectureId) throws SQLException {
|
||||||
|
|
||||||
lectureService.changeState(lectureId);
|
lectureService.startClass(lectureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopOnline(Long userId, Long lectureId) throws SQLException {
|
public void stopOnline(Long userId, Long lectureId) throws SQLException {
|
||||||
lectureService.changeState(lectureId);
|
lectureService.startClass(lectureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user