77import boombimapi .domain .search .presentation .dto .res .SearchRes ;
88import boombimapi .global .response .BaseOKResponse ;
99import io .swagger .v3 .oas .annotations .Operation ;
10+ import io .swagger .v3 .oas .annotations .responses .ApiResponse ;
11+ import io .swagger .v3 .oas .annotations .responses .ApiResponses ;
12+ import io .swagger .v3 .oas .annotations .tags .Tag ;
1013import lombok .RequiredArgsConstructor ;
1114import lombok .extern .slf4j .Slf4j ;
1215import org .springframework .http .HttpStatus ;
2326@ RequestMapping ("/api/search" )
2427@ RequiredArgsConstructor
2528@ Slf4j
29+ @ Tag (name = "Search" , description = "검색 관련 API" )
2630public class SearchController {
2731
2832 private final SearchService searchService ;
29-
30- @ Operation (description = "검색 내역 조회 10개만" )
33+ @ Operation (summary = "검색 내역 조회" , description = "사용자가 입력한 검색 내역 조회합니다. " )
34+ @ ApiResponses (value = {
35+ @ ApiResponse (responseCode = "200" , description = "검색 내역 조회 성공" ),
36+ })
3137 @ GetMapping ("/history" )
3238 public ResponseEntity <List <SearchHistoryRes >> getSearchHistory (@ AuthenticationPrincipal String userId ) {
3339 return ResponseEntity .ok (searchService .getSearchHistory (userId ));
3440 }
3541
36- @ Operation (description = "연관검색어" )
42+ @ Operation (summary = "연관 검색어" , description = "연관 검색어가 나옵니다. 최대 20개까지 나옵니다." )
43+ @ ApiResponses (value = {
44+ @ ApiResponse (responseCode = "200" , description = "연관 검색어 조회 성공" ),
45+ })
3746 @ GetMapping ("/related" )
3847 public ResponseEntity <List <SearchRelatedRes >> getSearchRelated (@ RequestParam String posName ) {
3948 return ResponseEntity .ok (searchService .getSearchRelated (posName ));
4049 }
4150
42- @ Operation (description = "검색 결과 및 검색 내용 저장" )
51+ @ Operation (summary = "검색 상세 조회" , description = "검색 버튼을 누르면 실행되는 API 입니다." )
52+ @ ApiResponses (value = {
53+ @ ApiResponse (responseCode = "200" , description = "검색 상세 조회 성공" ),
54+ })
4355 @ GetMapping
4456 public ResponseEntity <List <SearchRes >> getSearch (
4557 @ RequestParam String posName ,
@@ -48,7 +60,11 @@ public ResponseEntity<List<SearchRes>> getSearch(
4860 return ResponseEntity .ok (searchService .getSearch (posName , userId ));
4961 }
5062
51- @ Operation (description = "개인 삭제" )
63+ @ Operation (summary = "검색 내역 개별 삭제" , description = "검색 내역을 개별 삭제를 합니다." )
64+ @ ApiResponses (value = {
65+ @ ApiResponse (responseCode = "200" , description = "검색 삭제 성공" ),
66+ @ ApiResponse (responseCode = "404" , description = "검색 ID 존재하지가 않음" ),
67+ })
5268 @ DeleteMapping
5369 public ResponseEntity <BaseOKResponse <Void >> deletePersonal (
5470 @ AuthenticationPrincipal String userId ,
@@ -60,7 +76,10 @@ public ResponseEntity<BaseOKResponse<Void>> deletePersonal(
6076 DELETE_SEARCH_SUCCESS ));
6177 }
6278
63- @ Operation (description = "전체 삭제" )
79+ @ Operation (summary = "검색 내역 전체 삭제" , description = "검색 내역을 전체를 삭제를 합니다." )
80+ @ ApiResponses (value = {
81+ @ ApiResponse (responseCode = "200" , description = "검색 전체 삭제 성공" ),
82+ })
6483 @ DeleteMapping ("/all" )
6584 public ResponseEntity <BaseOKResponse <Void >> deleteAll (@ AuthenticationPrincipal String userId ) {
6685
0 commit comments