11package com .back .web7_9_codecrete_be .domain .plans .controller ;
22
3+ import com .back .web7_9_codecrete_be .domain .plans .dto .request .PlanAddRequest ;
4+ import com .back .web7_9_codecrete_be .domain .plans .dto .request .PlanUpdateRequest ;
5+ import com .back .web7_9_codecrete_be .domain .plans .dto .response .PlanDeleteResponse ;
6+ import com .back .web7_9_codecrete_be .domain .plans .dto .response .PlanDetailResponse ;
7+ import com .back .web7_9_codecrete_be .domain .plans .dto .response .PlanListResponse ;
8+ import com .back .web7_9_codecrete_be .domain .plans .dto .response .PlanResponse ;
9+ import com .back .web7_9_codecrete_be .domain .plans .service .PlanService ;
10+ import com .back .web7_9_codecrete_be .global .rsData .RsData ;
11+ import io .swagger .v3 .oas .annotations .Operation ;
12+ import io .swagger .v3 .oas .annotations .tags .Tag ;
13+ import jakarta .validation .Valid ;
314import lombok .RequiredArgsConstructor ;
15+ import org .springframework .http .HttpStatus ;
416import org .springframework .web .bind .annotation .*;
517
18+ import java .util .List ;
19+
20+
621@ RestController
722@ RequestMapping ("/api/v1/plans" )
823@ RequiredArgsConstructor
24+ @ Tag (name = "Plans" , description = "계획(Plans) 관련 API" )
925public class PlanController {
10- // GET /api/v1/plans/list/ - 계획 목록 조회
11- // GET /api/v1/plans/{planID} - 계획 상세 조회
12- // POST /api/v1/plans/{concertID} - 계획 생성
13- // PATCH /api/v1/plans/update/{planID} - 계획 수정
14- // DELETE /api/v1/plans/delete/{planID} - 계획 삭제
26+
27+ private final PlanService planService ;
28+
29+ /**
30+ * 계획 목록 조회
31+ *
32+ * @return 계획 목록 (200 OK)
33+ */
34+ @ GetMapping ("/list" )
35+ @ Operation (summary = "계획 목록 조회" , description = "사용자의 계획 목록을 조회합니다." )
36+ public RsData <List <PlanListResponse >> getPlanList (@ RequestParam Long userId ) {
37+ List <PlanListResponse > planList = planService .getPlanList (userId );
38+ return RsData .success ("계획 목록 조회 성공" , planList );
39+ }
40+
41+ /**
42+ * 계획 상세 조회
43+ *
44+ * @param planId 계획 ID
45+ * @return 계획 상세 정보 (200 OK)
46+ */
47+ @ GetMapping ("/{planId}" )
48+ @ Operation (summary = "계획 상세 조회" , description = "특정 계획의 상세 정보를 조회합니다." )
49+ public RsData <PlanDetailResponse > getPlanDetail (@ PathVariable Long planId ,
50+ @ RequestParam Long userId ) {
51+ PlanDetailResponse planDetail = planService .getPlanDetail (planId , userId );
52+ return RsData .success ("계획 상세 조회 성공" , planDetail );
53+ }
54+
55+ /**
56+ * 계획 생성
57+ *
58+ * @param concertId 콘서트 ID
59+ * @param request 계획 생성 요청 DTO
60+ * @return 생성된 계획 정보 (201 Created)
61+ */
62+ @ PostMapping ("/{concertId}" )
63+ @ Operation (summary = "계획 생성" , description = "새로운 계획을 생성합니다." )
64+ public RsData <PlanResponse > createPlan (
65+ @ PathVariable Long concertId ,
66+ @ Valid @ RequestBody PlanAddRequest request ) {
67+ PlanResponse planResponse = planService .createPlan (concertId , request );
68+ return RsData .success (HttpStatus .CREATED , "계획 생성 성공" , planResponse );
69+ }
70+
71+ /**
72+ * 계획 수정
73+ *
74+ * @param planId 계획 ID
75+ * @param request 계획 수정 요청 DTO
76+ * @return 수정된 계획 정보 (200 OK)
77+ */
78+ @ PatchMapping ("/update/{planId}" )
79+ @ Operation (summary = "계획 수정" , description = "기존 계획의 정보를 수정합니다." )
80+ public RsData <PlanResponse > updatePlan (
81+ @ PathVariable Long planId ,
82+ @ Valid @ RequestBody PlanUpdateRequest request ) {
83+ PlanResponse planResponse = planService .updatePlan (planId , request );
84+ return RsData .success ("계획 수정 성공" , planResponse );
85+ }
86+
87+ /**
88+ * 계획 삭제
89+ *
90+ * @param planId 계획 ID
91+ * @return 삭제된 계획 ID (200 OK)
92+ */
93+ @ DeleteMapping ("/delete/{planId}" )
94+ @ Operation (summary = "계획 삭제" , description = "기존 계획을 삭제합니다." )
95+ public RsData <PlanDeleteResponse > deletePlan (@ PathVariable Long planId ) {
96+ PlanDeleteResponse deleteResponse = planService .deletePlan (planId );
97+ return RsData .success ("계획 삭제 성공" , deleteResponse );
98+ }
99+
100+
15101 // POST /api/v1/plans/invite/{planID} - 계획 공유 초대
16102 // POST /api/v1/plans/accept/{planID} - 계획 공유 수락
17103 // POST /api/v1/plans/deny/{planID} - 계획 공유 거절
18104 // DELETE /api/v1/plans/kick/{planID} - 계획 공유 인원 추방
19105 // DELETE /api/v1/plans/quit/{planID} - 계획 공유 나가기
20- }
21-
106+ }
0 commit comments