1010import ita .tinybite .domain .auth .entity .JwtTokenProvider ;
1111import ita .tinybite .domain .chat .entity .ChatRoom ;
1212import ita .tinybite .domain .party .dto .request .PartyCreateRequest ;
13+ import ita .tinybite .domain .party .dto .request .PartyUpdateRequest ;
1314import ita .tinybite .domain .party .dto .response .ChatRoomResponse ;
1415import ita .tinybite .domain .party .dto .response .PartyDetailResponse ;
1516import ita .tinybite .domain .party .dto .response .PartyListResponse ;
1920import jakarta .validation .Valid ;
2021import lombok .RequiredArgsConstructor ;
2122import org .springframework .http .ResponseEntity ;
22- import org .springframework .web .bind .annotation .GetMapping ;
23- import org .springframework .web .bind .annotation .PathVariable ;
24- import org .springframework .web .bind .annotation .PostMapping ;
25- import org .springframework .web .bind .annotation .RequestBody ;
26- import org .springframework .web .bind .annotation .RequestHeader ;
27- import org .springframework .web .bind .annotation .RequestMapping ;
28- import org .springframework .web .bind .annotation .RequestParam ;
29- import org .springframework .web .bind .annotation .RestController ;
23+ import org .springframework .security .core .annotation .AuthenticationPrincipal ;
24+ import org .springframework .web .ErrorResponse ;
25+ import org .springframework .web .bind .annotation .*;
3026
3127import java .util .List ;
3228
@@ -272,8 +268,6 @@ public ResponseEntity<List<PartyParticipant>> getPendingParticipants(
272268 return ResponseEntity .ok (participants );
273269 }
274270
275-
276-
277271 /**
278272 * 파티 목록 조회 (홈 화면)
279273 */
@@ -374,4 +368,90 @@ public ResponseEntity<Long> createParty(
374368 return ResponseEntity .ok (partyId );
375369 }
376370
371+ /**
372+ * 파티 수정
373+ */
374+ @ Operation (
375+ summary = "파티 수정" ,
376+ description = """
377+ 파티 정보를 수정합니다.
378+
379+ **수정 권한**
380+ - 파티 호스트만 수정 가능
381+
382+ **수정 가능 범위**
383+ - 승인된 파티원이 없을 때: 모든 항목 수정 가능
384+ - 승인된 파티원이 있을 때: 설명, 이미지만 수정 가능 (가격, 인원, 수령 정보 수정 불가)
385+ """
386+ )
387+ @ ApiResponses ({
388+ @ ApiResponse (
389+ responseCode = "200" ,
390+ description = "파티 수정 성공"
391+ ),
392+ @ ApiResponse (
393+ responseCode = "400" ,
394+ description = "잘못된 요청 (수정 권한 없음, 유효하지 않은 데이터)" ,
395+ content = @ Content (schema = @ Schema (implementation = ErrorResponse .class ))
396+ ),
397+ @ ApiResponse (
398+ responseCode = "404" ,
399+ description = "파티를 찾을 수 없음" ,
400+ content = @ Content (schema = @ Schema (implementation = ErrorResponse .class ))
401+ )
402+ })
403+ @ PatchMapping ("/{partyId}" )
404+ public ResponseEntity <Void > updateParty (
405+ @ PathVariable Long partyId ,
406+ @ AuthenticationPrincipal Long userId ,
407+ @ RequestBody PartyUpdateRequest request ) {
408+
409+ partyService .updateParty (partyId , userId , request );
410+ return ResponseEntity .ok ().build ();
411+ }
412+
413+ /**
414+ * 파티 삭제
415+ */
416+ @ Operation (
417+ summary = "파티 삭제" ,
418+ description = """
419+ 파티를 삭제합니다.
420+
421+ **삭제 권한**
422+ - 파티 호스트만 삭제 가능
423+
424+ **삭제 제한**
425+ - 승인된 파티원이 있는 경우 삭제 불가능
426+ - 승인된 파티원이 없을 때만 삭제 가능
427+
428+ **삭제 시 처리**
429+ - 관련 채팅방 비활성화
430+ - 대기 중인 참가 신청 모두 삭제
431+ """
432+ )
433+ @ ApiResponses ({
434+ @ ApiResponse (
435+ responseCode = "204" ,
436+ description = "파티 삭제 성공"
437+ ),
438+ @ ApiResponse (
439+ responseCode = "400" ,
440+ description = "잘못된 요청 (삭제 권한 없음, 승인된 파티원 존재)" ,
441+ content = @ Content (schema = @ Schema (implementation = ErrorResponse .class ))
442+ ),
443+ @ ApiResponse (
444+ responseCode = "404" ,
445+ description = "파티를 찾을 수 없음" ,
446+ content = @ Content (schema = @ Schema (implementation = ErrorResponse .class ))
447+ )
448+ })
449+ @ DeleteMapping ("/{partyId}" )
450+ public ResponseEntity <Void > deleteParty (
451+ @ PathVariable Long partyId ,
452+ @ AuthenticationPrincipal Long userId ) {
453+
454+ partyService .deleteParty (partyId , userId );
455+ return ResponseEntity .noContent ().build ();
456+ }
377457}
0 commit comments