feat: 방 삭제
This commit is contained in:
parent
d494e1f1b9
commit
38c747e7d4
@ -29,7 +29,9 @@ public interface LectureService {
|
|||||||
|
|
||||||
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