1010import fitfit .domain .search .service .SearchCommandService ;
1111import fitfit .domain .search .service .SearchQueryService ;
1212import fitfit .global .apiPayload .ApiResponse ;
13+ import fitfit .global .apiPayload .code .status .SuccessStatus ;
1314import io .swagger .v3 .oas .annotations .Operation ;
1415import io .swagger .v3 .oas .annotations .media .Content ;
1516import io .swagger .v3 .oas .annotations .media .Schema ;
2122import org .springframework .web .bind .annotation .*;
2223
2324import java .io .IOException ;
25+ import java .util .List ;
2426
2527@ RestController
2628@ RequiredArgsConstructor
@@ -51,7 +53,7 @@ public ApiResponse<ClothesResponseDTO.CreateClothesResponse> registerClothes(
5153 return ApiResponse .onSuccess (response );
5254 }
5355
54- @ DeleteMapping ("/{clothesId} " )
56+ @ DeleteMapping ("/delete " )
5557 @ Operation (summary = "판매 옷 삭제 API" , description = "자신이 등록한 판매 옷을 삭제하는 API입니다." )
5658 @ ApiResponses ({
5759 @ io .swagger .v3 .oas .annotations .responses .ApiResponse (responseCode = "200" , description = "OK, 성공" ),
@@ -61,11 +63,27 @@ public ApiResponse<ClothesResponseDTO.CreateClothesResponse> registerClothes(
6163 })
6264 public ApiResponse <String > deleteClothes (
6365 @ RequestHeader (value = "Authorization" ) String authorization ,
64- @ PathVariable ( name = "clothesId" ) Long clothesId ) {
65- clothesCommandService .deleteClothes (authorization , clothesId );
66+ @ Valid @ RequestBody ClothesRequestDTO . DeleteRequest request ) {
67+ clothesCommandService .deleteClothes (authorization , request );
6668 return ApiResponse .onSuccess ("판매 옷 삭제에 성공했습니다." );
6769 }
6870
71+ @ PatchMapping ("/update" )
72+ @ Operation (summary = "판매글 수정 API" , description = "자신이 작성한 판매글의 제목, 내용, 가격 등을 선택 수정합니다." )
73+ @ ApiResponses ({
74+ @ io .swagger .v3 .oas .annotations .responses .ApiResponse (responseCode = "200" , description = "OK, 성공" ),
75+ @ io .swagger .v3 .oas .annotations .responses .ApiResponse (responseCode = "400" , description = "유효성 검사 실패(잘못된 요청 형식)" , content = @ Content (schema = @ Schema (implementation = ApiResponse .class ))),
76+ @ io .swagger .v3 .oas .annotations .responses .ApiResponse (responseCode = "403" , description = "수정 권한 없음" ,content = @ Content (schema = @ Schema (implementation = ApiResponse .class ))),
77+ @ io .swagger .v3 .oas .annotations .responses .ApiResponse (responseCode = "404" , description = "판매글을 찾을 수 없음" ,content = @ Content (schema = @ Schema (implementation = ApiResponse .class ))),
78+ })
79+ public ApiResponse <ClothesResponseDTO .UpdateResponse > updateClothes (
80+ @ RequestHeader (value = "Authorization" ) String authorization ,
81+ @ Valid @ RequestBody ClothesRequestDTO .UpdateRequest request ) {
82+
83+ ClothesResponseDTO .UpdateResponse response = clothesCommandService .updateClothes (authorization , request );
84+ return ApiResponse .onSuccess (response );
85+ }
86+
6987 @ GetMapping ("/search" )
7088 @ Operation (summary = "판매 옷 일반 검색 API" , description = """
7189 키워드 검색을 통해 판매 옷 정보를 가져오는 API입니다. (존재하지 않는 키워드인 경우 빈 리스트로 응답)
@@ -123,4 +141,31 @@ public ApiResponse<SearchResponseDTO.SearchRecordPageDTO> getSearchRecord(
123141 SearchResponseDTO .SearchRecordPageDTO response = searchQueryService .getSearchRecord (authorization , page );
124142 return ApiResponse .onSuccess (response );
125143 }
144+
145+ @ GetMapping ("/map" )
146+ @ Operation (
147+ summary = "지도 마커(핀) 전체 조회" ,
148+ description = """
149+ 지도에 표시할 **판매 중인 모든 상품**의 위치와 썸네일 정보를 조회합니다.
150+
151+ - **반환 데이터:** 위도(lat), 경도(lng), 상품ID, 썸네일URL, 가격, 주소
152+ - **사용 시점:** 지도 탭에 처음 들어갔을 때 호출하여 마커를 찍습니다.
153+ - **참고:** 판매 완료된 상품은 조회되지 않습니다.
154+ """
155+ )
156+ @ ApiResponses ({
157+ @ io .swagger .v3 .oas .annotations .responses .ApiResponse (
158+ responseCode = "200" ,
159+ description = "성공 (마커 리스트 반환)" ,
160+ content = @ Content (schema = @ Schema (implementation = ClothesResponseDTO .MapMarkerDTO .class ))
161+ ),
162+ @ io .swagger .v3 .oas .annotations .responses .ApiResponse (
163+ responseCode = "500" ,
164+ description = "서버 에러, 관리자에게 문의 바랍니다. (COMMON500)"
165+ )
166+ })
167+ public ApiResponse <List <ClothesResponseDTO .MapMarkerDTO >> getMapMarkers () {
168+ List <ClothesResponseDTO .MapMarkerDTO > result = clothesQueryService .getMapMarkers ();
169+ return ApiResponse .of (SuccessStatus ._OK , result );
170+ }
126171}
0 commit comments