From cb28eb2cd230b943e6637adcd95f1803170808b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A0=95=EB=AF=BC?= Date: Mon, 5 Aug 2024 17:12:11 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20joinroom,makeroom,deleteroom=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edufocus/video/controller/Controller.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java b/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java index efb4a64..88ff332 100644 --- a/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java +++ b/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java @@ -88,7 +88,7 @@ public class Controller { return ResponseEntity.ok(Map.of("token", token.toJwt())); } else { - return ResponseEntity.status(HttpStatus.BAD_REQUEST) + return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(Map.of("error", "방에 들어갈 수 없습니다.")); } @@ -108,6 +108,8 @@ public class Controller { return ResponseEntity.ok(Map.of("token", token.toJwt())); + } else { + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(Map.of("error", "자신의 강의가 아닙니다.")); } @@ -124,12 +126,15 @@ public class Controller { Long userId = Long.parseLong(jwtUtil.getUserId(userToken)); User findUser = userRepository.findById(userId).orElse(null); - if (findUser.getRole() == UserRole.ADMIN) { + if (findUser.getRole() == UserRole.ADMIN && videoSertvice.checkAdmin(userId, id)) { videoSertvice.startOnline(userId, id); + } else { + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(Map.of("error", "들어갈수없는 계정입니다")); + } return ResponseEntity.ok(Map.of("token", " ")); @@ -146,7 +151,7 @@ public class Controller { if (findUser.getRole() == UserRole.ADMIN) { - videoSertvice.startOnline(userId, id); + videoSertvice.stopOnline(userId, id); }