2727@ RequiredArgsConstructor
2828public class RoomController {
2929
30+ // ✨ Controller는 이제 Service에만 의존합니다. 훨씬 깔끔해졌죠!
3031 private final RoomService roomService ;
3132
32- // --- 방 관리 ---
33+ // --- 1. 방 관리 ---
3334 @ Operation (summary = "새로운 협업 방 생성" , description = "DB에 새로운 협업 방을 생성하고, 방장을 첫 참여자로 자동 등록합니다." )
3435 @ ApiResponses ({
3536 @ ApiResponse (responseCode = "200" , description = "방 생성 성공" , content = @ Content (schema = @ Schema (implementation = RoomResponse .class ))),
@@ -42,7 +43,7 @@ public ResponseEntity<RoomResponse> createRoom(@RequestBody CreateRoomRequest re
4243 return ResponseEntity .ok (response );
4344 }
4445
45- @ Operation (summary = "방에서 참가자 강퇴 (방장 전용)" , description = "방장이 특정 참가자를 방에서 영구적으로 제외시킵니다. 강퇴된 참가자는 해당 방의 모든 세션에서도 제거됩니다. " )
46+ @ Operation (summary = "방에서 참가자 강퇴 (방장 전용)" , description = "방장이 특정 참가자를 방에서 영구적으로 제외시킵니다." )
4647 @ ApiResponses ({
4748 @ ApiResponse (responseCode = "200" , description = "강퇴 성공" ),
4849 @ ApiResponse (responseCode = "401" , description = "인증 실패" ),
@@ -58,8 +59,22 @@ public ResponseEntity<Void> kickParticipant(
5859 return ResponseEntity .ok ().build ();
5960 }
6061
61- // --- 세션 관리 ---
62- @ Operation (summary = "방 안에 새 코드 세션 생성 (방송 시작)" , description = "기존 방 안에 독립적인 새 코드 편집 세션을 생성합니다. 생성자는 자동으로 쓰기 권한을 가집니다." )
62+ @ Operation (summary = "협업 방에 참여자로 등록" , description = "사용자가 특정 방에 참여자로 자신을 등록합니다. 웹소켓에 연결하기 전에 반드시 호출해야 합니다." )
63+ @ ApiResponses ({
64+ @ ApiResponse (responseCode = "200" , description = "참여 등록 성공" ),
65+ @ ApiResponse (responseCode = "401" , description = "인증 실패" ),
66+ @ ApiResponse (responseCode = "404" , description = "존재하지 않는 방" )
67+ })
68+ @ PostMapping ("/rooms/{roomId}/participants" )
69+ public ResponseEntity <Void > joinRoom (
70+ @ Parameter (description = "참여할 방의 고유 ID" ) @ PathVariable String roomId ,
71+ @ AuthenticationPrincipal CustomUserDetails userDetails ) {
72+ roomService .joinRoom (roomId , userDetails .getUsername ());
73+ return ResponseEntity .ok ().build ();
74+ }
75+
76+ // --- 2. 세션 관리 ---
77+ @ Operation (summary = "방 안에 새 코드 세션 생성 (방송 시작)" , description = "기존 방 안에 독립적인 새 코드 편집 세션을 생성합니다." )
6378 @ ApiResponses ({
6479 @ ApiResponse (responseCode = "200" , description = "세션 생성 성공" , content = @ Content (schema = @ Schema (implementation = SessionResponse .class ))),
6580 @ ApiResponse (responseCode = "401" , description = "인증 실패" ),
@@ -91,7 +106,7 @@ public ResponseEntity<Void> updateSessionStatus(
91106 return ResponseEntity .ok ().build ();
92107 }
93108
94- // --- 세션 권한 관리 ---
109+ // --- 3. 세션 권한 관리 ---
95110 @ Operation (summary = "세션 내 쓰기 권한 부여 (세션 생성자 전용)" , description = "세션 생성자가 특정 참가자에게 해당 세션의 쓰기 권한을 부여합니다." )
96111 @ ApiResponses ({
97112 @ ApiResponse (responseCode = "200" , description = "권한 부여 성공" ),
0 commit comments