feat: 방 삭제
This commit is contained in:
parent
d494e1f1b9
commit
38c747e7d4
@ -22,14 +22,16 @@ public interface LectureService {
|
||||
List<LectureSearchResponse> findAllLecture();
|
||||
|
||||
String getUserStatus(Long userId, Lecture lecture);
|
||||
|
||||
|
||||
LectureDetailResponse findLectureById(Long userId, long lectureId);
|
||||
|
||||
List<LectureSearchResponse> findMyLecture(long userId);
|
||||
|
||||
Lecture findLectureByTitle(String title);
|
||||
|
||||
void changeState(Long lectureId);
|
||||
void startClass(Long lectureId);
|
||||
|
||||
void stopClass(Long lectureId);
|
||||
|
||||
boolean getState(Long lectureId);
|
||||
|
||||
|
@ -225,7 +225,7 @@ public class LectureServiceImpl implements LectureService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeState(Long id) {
|
||||
public void startClass(Long id) {
|
||||
|
||||
Optional<Lecture> lecture = lectureRepository.findById(id);
|
||||
|
||||
@ -245,6 +245,26 @@ public class LectureServiceImpl implements LectureService {
|
||||
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
|
||||
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")
|
||||
public ResponseEntity<String> receiveWebhook(@RequestHeader("Authorization") String authHeader, @RequestBody String body) {
|
||||
WebhookReceiver webhookReceiver = new WebhookReceiver(LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
|
||||
|
@ -24,12 +24,12 @@ public class VideoServiceImpl implements VideoSertvice {
|
||||
@Override
|
||||
public void startOnline(Long userId, Long lectureId) throws SQLException {
|
||||
|
||||
lectureService.changeState(lectureId);
|
||||
lectureService.startClass(lectureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopOnline(Long userId, Long lectureId) throws SQLException {
|
||||
lectureService.changeState(lectureId);
|
||||
lectureService.startClass(lectureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user