11package dmu .dasom .api .domain .activity .controller ;
22
3- import dmu .dasom .api .domain .activity .dto .ActivityHistoryRequestDto ;
4- import dmu .dasom .api .domain .activity .dto .ActivityHistoryResponseDto ;
5- import dmu .dasom .api .domain .activity .service .ActivityHistoryService ;
3+ import dmu .dasom .api .domain .activity .dto .ActivityRequestDto ;
4+ import dmu .dasom .api .domain .activity .service .ActivityService ;
65import dmu .dasom .api .domain .common .exception .ErrorResponse ;
76import io .swagger .v3 .oas .annotations .Operation ;
87import io .swagger .v3 .oas .annotations .media .Content ;
1817import org .springframework .web .bind .annotation .*;
1918
2019@ RestController
21- @ RequestMapping ("/api/admin/activity/histories " )
20+ @ RequestMapping ("/api/admin/activities " )
2221@ RequiredArgsConstructor
23- @ Tag (name = "ADMIN - Activity History API" , description = "어드민 활동 연혁 관리 API" )
24- public class AdminActivityHistoryController {
22+ @ Tag (name = "ADMIN - Activity API" , description = "어드민 활동 연혁 관리 API" )
23+ public class AdminActivityController {
2524
26- private final ActivityHistoryService historyService ;
25+ private final ActivityService activityService ;
2726
2827 @ Operation (summary = "활동 연혁 생성" )
2928 @ ApiResponses (value = {
@@ -34,8 +33,9 @@ public class AdminActivityHistoryController {
3433 @ ApiResponse (responseCode = "500" , description = "서버 내부 오류" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ErrorResponse .class ), examples = @ ExampleObject (name = "서버 문제 발생" , value = "{ \" code\" : \" C009\" , \" message\" : \" 서버에 문제가 발생하였습니다.\" }" )))
3534 })
3635 @ PostMapping
37- public ResponseEntity <ActivityHistoryResponseDto > createHistory (@ Valid @ RequestBody ActivityHistoryRequestDto requestDto ) {
38- return ResponseEntity .status (201 ).body (historyService .createHistory (requestDto ));
36+ public ResponseEntity <Void > createActivity (@ Valid @ RequestBody ActivityRequestDto requestDto ) {
37+ activityService .createActivity (requestDto );
38+ return ResponseEntity .status (201 ).build ();
3939 }
4040
4141 @ Operation (summary = "활동 연혁 수정" )
@@ -47,25 +47,26 @@ public ResponseEntity<ActivityHistoryResponseDto> createHistory(@Valid @RequestB
4747 @ ApiResponse (responseCode = "404" , description = "수정할 리소스를 찾을 수 없음" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ErrorResponse .class ), examples = @ ExampleObject (name = "조회 결과 없음" , value = "{ \" code\" : \" C010\" , \" message\" : \" 해당 리소스를 찾을 수 없습니다.\" }" ))),
4848 @ ApiResponse (responseCode = "500" , description = "서버 내부 오류" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ErrorResponse .class ), examples = @ ExampleObject (name = "서버 문제 발생" , value = "{ \" code\" : \" C009\" , \" message\" : \" 서버에 문제가 발생하였습니다.\" }" )))
4949 })
50- @ PutMapping ("/{id }" )
51- public ResponseEntity <ActivityHistoryResponseDto > updateHistory (
52- @ PathVariable @ Min (1 ) Long id ,
53- @ Valid @ RequestBody ActivityHistoryRequestDto requestDto
50+ @ PutMapping ("/{activityId }" )
51+ public ResponseEntity <Void > updateActivity (
52+ @ PathVariable @ Min (1 ) Long activityId ,
53+ @ Valid @ RequestBody ActivityRequestDto requestDto
5454 ) {
55- return ResponseEntity .ok (historyService .updateHistory (id , requestDto ));
55+ activityService .updateActivity (activityId , requestDto );
56+ return ResponseEntity .ok ().build ();
5657 }
5758
5859 @ Operation (summary = "활동 연혁 삭제" )
5960 @ ApiResponses (value = {
60- @ ApiResponse (responseCode = "200 " , description = "활동 연혁 삭제 성공" ),
61+ @ ApiResponse (responseCode = "204 " , description = "활동 연혁 삭제 성공" ),
6162 @ ApiResponse (responseCode = "401" , description = "인증되지 않은 사용자" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ErrorResponse .class ), examples = @ ExampleObject (name = "인증 실패" , value = "{ \" code\" : \" C001\" , \" message\" : \" 인증되지 않은 사용자입니다.\" }" ))),
6263 @ ApiResponse (responseCode = "403" , description = "접근 권한 없음 (ADMIN이 아님)" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ErrorResponse .class ), examples = @ ExampleObject (name = "권한 없음" , value = "{ \" code\" : \" C002\" , \" message\" : \" 접근 권한이 없습니다.\" }" ))),
6364 @ ApiResponse (responseCode = "404" , description = "삭제할 리소스를 찾을 수 없음" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ErrorResponse .class ), examples = @ ExampleObject (name = "조회 결과 없음" , value = "{ \" code\" : \" C010\" , \" message\" : \" 해당 리소스를 찾을 수 없습니다.\" }" ))),
6465 @ ApiResponse (responseCode = "500" , description = "서버 내부 오류" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ErrorResponse .class ), examples = @ ExampleObject (name = "서버 문제 발생" , value = "{ \" code\" : \" C009\" , \" message\" : \" 서버에 문제가 발생하였습니다.\" }" )))
6566 })
66- @ DeleteMapping ("/{id }" )
67- public ResponseEntity <Void > deleteHistory (@ PathVariable Long id ) {
68- historyService . deleteHistory ( id );
69- return ResponseEntity .noContent ().build (); // 삭제 성공 시에는 204 No Content가 더 명확합니다.
67+ @ DeleteMapping ("/{activityId }" )
68+ public ResponseEntity <Void > deleteActivity (@ PathVariable Long activityId ) {
69+ activityService . deleteActivity ( activityId );
70+ return ResponseEntity .noContent ().build ();
7071 }
71- }
72+ }
0 commit comments