11package com .back .domain .study .plan .controller ;
22
3- import com .back .domain .study .plan .dto .StudyPlanDeleteRequest ;
43import com .back .domain .study .plan .dto .StudyPlanRequest ;
54import com .back .domain .study .plan .dto .StudyPlanListResponse ;
65import com .back .domain .study .plan .dto .StudyPlanResponse ;
76import com .back .domain .study .plan .entity .ApplyScope ;
87import com .back .domain .study .plan .service .StudyPlanService ;
98import com .back .global .common .dto .RsData ;
109import com .back .global .security .CustomUserDetails ;
10+ import io .swagger .v3 .oas .annotations .Operation ;
11+ import io .swagger .v3 .oas .annotations .tags .Tag ;
1112import lombok .RequiredArgsConstructor ;
1213import org .springframework .format .annotation .DateTimeFormat ;
1314import org .springframework .http .ResponseEntity ;
2021@ RestController
2122@ RequiredArgsConstructor
2223@ RequestMapping ("/api/plans" )
24+ @ Tag (name = "StudyPlan" , description = "학습 계획 관련 API" )
2325public class StudyPlanController {
2426 private final StudyPlanService studyPlanService ;
2527 // ==================== 생성 ===================
2628 @ PostMapping
29+ @ Operation ( summary = "학습 계획 생성" ,
30+ description = "새로운 학습 계획을 생성합니다. 반복 계획 생성 시 최초 계획이 원본 계획으로서 db에 저장되고" +
31+ " 이후 반복되는 계획들은 가상 계획으로서 db에는 없지만 조회 시 가상으로 생성됩니다" )
32+
2733 public ResponseEntity <RsData <StudyPlanResponse >> createStudyPlan (
2834 // 로그인 유저 정보 받기 @AuthenticationPrincipal CustomUserDetails user,
2935 @ RequestBody StudyPlanRequest request ) {
@@ -36,6 +42,10 @@ public ResponseEntity<RsData<StudyPlanResponse>> createStudyPlan(
3642 // ==================== 조회 ===================
3743 // 특정 날짜의 계획들 조회. date 형식: YYYY-MM-DD
3844 @ GetMapping ("/date/{date}" )
45+ @ Operation (
46+ summary = "특정 날짜의 학습 계획 조회" ,
47+ description = "지정 날짜에 해당하는 모든 학습 계획을 조회합니다."
48+ )
3949 public ResponseEntity <RsData <StudyPlanListResponse >> getStudyPlansForDate (
4050 @ AuthenticationPrincipal CustomUserDetails user ,
4151 @ PathVariable @ DateTimeFormat (iso = DateTimeFormat .ISO .DATE ) LocalDate date ) {
@@ -51,6 +61,10 @@ public ResponseEntity<RsData<StudyPlanListResponse>> getStudyPlansForDate(
5161
5262 // 기간별 계획 조회. start, end 형식: YYYY-MM-DD
5363 @ GetMapping
64+ @ Operation (
65+ summary = "기간별 학습 계획 조회" ,
66+ description = "기간에 해당하는 모든 학습 계획을 조회합니다."
67+ )
5468 public ResponseEntity <RsData <List <StudyPlanResponse >>> getStudyPlansForPeriod (
5569 // @AuthenticationPrincipal CustomUserDetails user,
5670 @ RequestParam ("start" ) @ DateTimeFormat (iso = DateTimeFormat .ISO .DATE ) LocalDate startDate ,
@@ -70,6 +84,11 @@ public ResponseEntity<RsData<List<StudyPlanResponse>>> getStudyPlansForPeriod(
7084 // 가상인지 원본인지는 서비스에서 원본과 날짜를 대조해 판단
7185 // 수정 적용 범위를 쿼리 파라미터로 받음 (THIS_ONLY, FROM_THIS_DATE)
7286 @ PutMapping ("/{planId}" )
87+ @ Operation (
88+ summary = "학습 계획 수정" ,
89+ description = "기존 학습 계획을 수정합니다. 반복 계획의 경우 적용 범위를 applyScope로 설정 할 수 있으며" +
90+ "클라이언트에서는 paln에 repeat_rule이 있으면 반복 계획으로 간주하고 반드시 apply_scope를 쿼리 파라미터로 넘겨야 합니다." +
91+ "repeat_rule이 없으면 단발성 계획으로 간주하여 수정 범위를 설정 할 필요가 없으므로 apply_scope를 넘기지 않아도 됩니다." )
7392 public ResponseEntity <RsData <StudyPlanResponse >> updateStudyPlan (
7493 // @AuthenticationPrincipal CustomUserDetails user,
7594 @ PathVariable Long planId ,
@@ -83,12 +102,16 @@ public ResponseEntity<RsData<StudyPlanResponse>> updateStudyPlan(
83102 }
84103
85104
86-
87105 // ==================== 삭제 ===================
88106 // 플랜 아이디는 원본의 아이디를 받음
89107 // 가상인지 원본인지는 서비스에서 원본과 날짜를 대조해 판단
90108 // 삭제 적용 범위를 쿼리 파라미터로 받음 (THIS_ONLY, FROM_THIS_DATE)
91109 @ DeleteMapping ("/{planId}" )
110+ @ Operation (
111+ summary = "학습 계획 삭제" ,
112+ description = "기존 학습 계획을 삭제합니다. 반복 계획의 경우 적용 범위를 applyScope로 설정 할 수 있으며" +
113+ "클라이언트에서는 paln에 repeat_rule이 있으면 반복 계획으로 간주하고 반드시 apply_scope를 쿼리 파라미터로 넘겨야 합니다." +
114+ "repeat_rule이 없으면 단발성 계획으로 간주하여 삭제 범위를 설정 할 필요가 없으므로 apply_scope를 넘기지 않아도 됩니다." )
92115 public ResponseEntity <RsData <Void >> deleteStudyPlan (
93116 // @AuthenticationPrincipal CustomUserDetails user,
94117 @ PathVariable Long planId ,
0 commit comments