11package devkor .com .teamcback .domain .place .controller ;
22
3- import devkor .com .teamcback .domain .place .dto .response .DeletePlaceImageRes ;
4- import devkor .com .teamcback .domain .place .dto .response .ModifyPlaceImageRes ;
5- import devkor .com .teamcback .domain .place .dto .response .SavePlaceImageRes ;
6- import devkor .com .teamcback .domain .place .dto .response .SearchPlaceImageRes ;
3+ import devkor .com .teamcback .domain .place .dto .response .*;
74import devkor .com .teamcback .domain .place .service .AdminPlaceImageService ;
85import devkor .com .teamcback .global .response .CommonResponse ;
96import io .swagger .v3 .oas .annotations .Operation ;
1815import org .springframework .web .bind .annotation .GetMapping ;
1916import org .springframework .web .bind .annotation .PathVariable ;
2017import org .springframework .web .bind .annotation .PostMapping ;
21- import org .springframework .web .bind .annotation .PutMapping ;
2218import org .springframework .web .bind .annotation .RequestMapping ;
2319import org .springframework .web .bind .annotation .RequestPart ;
2420import org .springframework .web .bind .annotation .RestController ;
2521import org .springframework .web .multipart .MultipartFile ;
2622
23+ import java .util .List ;
24+
2725@ RestController
2826@ RequiredArgsConstructor
2927@ RequestMapping ("/api/admin/places" )
3028public class AdminPlaceImageController {
3129 private final AdminPlaceImageService adminPlaceImageService ;
3230
3331 @ PostMapping (value = "/{placeId}/image" , consumes = MediaType .MULTIPART_FORM_DATA_VALUE )
34- @ Operation (summary = "장소 사진 저장 " ,
35- description = "장소 사진 저장" )
32+ @ Operation (summary = "장소 사진 1장 추가 " ,
33+ description = "장소 사진 1장 추가 저장" )
3634 @ ApiResponses (value = {
3735 @ ApiResponse (responseCode = "200" , description = "정상 처리 되었습니다." ),
3836 @ ApiResponse (responseCode = "404" , description = "장소를 찾을 수 없습니다." ,
3937 content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
40- @ ApiResponse (responseCode = "409" , description = "해당 장소의 이미지가 이미 존재합니다." ,
41- content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
4238 @ ApiResponse (responseCode = "401" , description = "권한이 없습니다." ,
4339 content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
4440 })
@@ -49,26 +45,26 @@ public CommonResponse<SavePlaceImageRes> savePlaceImage(
4945 return CommonResponse .success (adminPlaceImageService .savePlaceImage (placeId , image ));
5046 }
5147
52- @ PutMapping (value = "/{placeId}/image " , consumes = MediaType .MULTIPART_FORM_DATA_VALUE )
53- @ Operation (summary = "장소 사진 수정 " ,
54- description = "장소 사진 수정 " )
48+ @ PostMapping (value = "/{placeId}/images " , consumes = MediaType .MULTIPART_FORM_DATA_VALUE )
49+ @ Operation (summary = "장소 사진 여러장 새로 저장 " ,
50+ description = "기존 장소 사진 전체 삭제 후 사진 여러장 새로 저장 " )
5551 @ ApiResponses (value = {
56- @ ApiResponse (responseCode = "200" , description = "정상 처리 되었습니다." ),
57- @ ApiResponse (responseCode = "404" , description = "장소를 찾을 수 없습니다." ,
58- content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
59- @ ApiResponse (responseCode = "401" , description = "권한이 없습니다." ,
60- content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
52+ @ ApiResponse (responseCode = "200" , description = "정상 처리 되었습니다." ),
53+ @ ApiResponse (responseCode = "404" , description = "장소를 찾을 수 없습니다." ,
54+ content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
55+ @ ApiResponse (responseCode = "401" , description = "권한이 없습니다." ,
56+ content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
6157 })
62- public CommonResponse <ModifyPlaceImageRes > modifyPlaceImage (
63- @ Parameter (name = "placeId" , description = "장소 ID" ) @ PathVariable Long placeId ,
64- @ Parameter (description = "수정할 사진 파일" ) @ RequestPart ("image" ) MultipartFile image
58+ public CommonResponse <SavePlaceImageRes > savePlaceImageList (
59+ @ Parameter (name = "placeId" , description = "장소 ID" ) @ PathVariable Long placeId ,
60+ @ Parameter (description = "저장할 사진 파일 목록 " ) @ RequestPart ("image" ) List < MultipartFile > images
6561 ) {
66- return CommonResponse .success (adminPlaceImageService .modifyPlaceImage (placeId , image ));
62+ return CommonResponse .success (adminPlaceImageService .savePlaceImageList (placeId , images ));
6763 }
6864
69- @ DeleteMapping (value = "/{placeId}/image " )
70- @ Operation (summary = "장소 사진 삭제" ,
71- description = "장소 사진 삭제" )
65+ @ DeleteMapping (value = "/{placeId}/images " )
66+ @ Operation (summary = "장소 사진 전체 삭제" ,
67+ description = "장소 사진 전체 삭제" )
7268 @ ApiResponses (value = {
7369 @ ApiResponse (responseCode = "200" , description = "정상 처리 되었습니다." ),
7470 @ ApiResponse (responseCode = "404" , description = "장소를 찾을 수 없습니다." ,
@@ -83,18 +79,34 @@ public CommonResponse<DeletePlaceImageRes> deletePlaceImage(
8379 }
8480
8581 @ GetMapping ("/{placeId}/image" )
86- @ Operation (summary = "장소 사진 검색" ,
87- description = "장소 사진 검색" )
82+ @ Operation (summary = "장소 사진 1장 검색" ,
83+ description = "장소 사진 1장 검색" )
8884 @ ApiResponses (value = {
8985 @ ApiResponse (responseCode = "200" , description = "정상 처리 되었습니다." ),
9086 @ ApiResponse (responseCode = "404" , description = "장소를 찾을 수 없습니다." ,
9187 content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
9288 @ ApiResponse (responseCode = "401" , description = "권한이 없습니다." ,
9389 content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
9490 })
95- public CommonResponse <SearchPlaceImageRes > getPlaceImage (
91+ public CommonResponse <GetPlaceImageRes > getPlaceImage (
9692 @ Parameter (name = "placeId" , description = "장소 ID" ) @ PathVariable Long placeId
9793 ) {
9894 return CommonResponse .success (adminPlaceImageService .searchPlaceImage (placeId ));
9995 }
96+
97+ @ GetMapping ("/{placeId}/images" )
98+ @ Operation (summary = "장소 사진 여러 장 검색" ,
99+ description = "장소 사진 여러 장 검색" )
100+ @ ApiResponses (value = {
101+ @ ApiResponse (responseCode = "200" , description = "정상 처리 되었습니다." ),
102+ @ ApiResponse (responseCode = "404" , description = "장소를 찾을 수 없습니다." ,
103+ content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
104+ @ ApiResponse (responseCode = "401" , description = "권한이 없습니다." ,
105+ content = @ Content (schema = @ Schema (implementation = CommonResponse .class ))),
106+ })
107+ public CommonResponse <SearchPlaceImageListRes > getPlaceImageList (
108+ @ Parameter (name = "placeId" , description = "장소 ID" ) @ PathVariable Long placeId
109+ ) {
110+ return CommonResponse .success (adminPlaceImageService .searchPlaceImageList (placeId ));
111+ }
100112}
0 commit comments