Skip to content

Commit f03d3e2

Browse files
committed
[Feat] Apply Swagger to search API
1 parent ada88de commit f03d3e2

4 files changed

Lines changed: 33 additions & 9 deletions

File tree

src/main/java/boombimapi/domain/search/application/impl/SearchServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private List<SearchRes> sortedCongestion(List<MemberPlace> memberPlaceEntities,
166166

167167

168168
result.add(SearchRes.of(memberPlace.getId(), memberPlace.getName(), latestMember.getCreatedAt(),
169-
latestMember.getCongestionLevel().getName(), "주소", memberPlace.getImageUrl()));
169+
latestMember.getCongestionLevel().getName(), memberPlace.getAddress(), memberPlace.getImageUrl()));
170170
}
171171
}
172172

@@ -176,7 +176,7 @@ private List<SearchRes> sortedCongestion(List<MemberPlace> memberPlaceEntities,
176176
officialCongestionRepository.findTopByOfficialPlaceIdOrderByObservedAtDesc(official.getId()).orElse(null);
177177
if (latestOfficial != null) {
178178
result.add(SearchRes.of(official.getId(), official.getName(), latestOfficial.getObservedAt(),
179-
latestOfficial.getCongestionLevel().getName(), "주소", official.getImageUrl()));
179+
latestOfficial.getCongestionLevel().getName(), "", official.getImageUrl()));
180180
}
181181
}
182182

src/main/java/boombimapi/domain/search/presentation/controller/SearchController.java

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import boombimapi.domain.search.presentation.dto.res.SearchRes;
88
import boombimapi.global.response.BaseOKResponse;
99
import 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;
1013
import lombok.RequiredArgsConstructor;
1114
import lombok.extern.slf4j.Slf4j;
1215
import org.springframework.http.HttpStatus;
@@ -23,23 +26,32 @@
2326
@RequestMapping("/api/search")
2427
@RequiredArgsConstructor
2528
@Slf4j
29+
@Tag(name = "Search", description = "검색 관련 API")
2630
public 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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
package boombimapi.domain.search.presentation.dto.req;
22

3+
import io.swagger.v3.oas.annotations.media.Schema;
4+
5+
@Schema(description = "검색 개별 삭제 DTO")
36
public record DeletePersonalReq(
7+
8+
@Schema(description = "검색 ID")
49
Long searchId
510
) {
611
}

src/main/java/boombimapi/domain/vote/application/service/impl/VoteServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void registerVote(String userId, VoteRegisterReq req) {
7373
if (user == null)
7474
throw new BoombimException(ErrorCode.USER_NOT_EXIST);
7575

76-
//위도 경도 100m 맞는지 true면 있음 false면 없음
76+
//위도 경도 100m 맞는지 true면 있음 false면 없음 ==> 이제부터 300m로 통일
7777
boolean result = isWithin300Meters(
7878
req.posLatitude(), req.posLongitude(),
7979
req.userLatitude(), req.userLongitude()

0 commit comments

Comments
 (0)