Skip to content

Commit

Permalink
Feat: 책 검색 API 수정
Browse files Browse the repository at this point in the history
- 책 검색 결과가 없는 경우 404 예외가 아닌 빈 리스트를 반환하도록 수정
  • Loading branch information
don9m1n committed Apr 8, 2024
1 parent f2195b9 commit 9943fc3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Response<BookDetailResponse> getBookInfo(@AuthenticationPrincipal CustomU
public Response<BookSearchApiResponse> searchBooks(@RequestParam(required = false) String q,
@RequestParam(defaultValue = "1") int start) {

return Response.success(HttpStatus.OK, "책 검색 성공", bookService.searchBooks(q, start));
return Response.success(HttpStatus.OK, "책 검색 결과 조회", bookService.searchBooks(q, start));
}

@Operation(summary = "책 검색 후 등록", description = "검색한 책 정보를 통해 책을 등록합니다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public BookSearchApiResponse searchBooks(String query, int start) {
throw new BookException(ErrorCode.EMPTY_SEARCH_KEYWORD);
}

BookSearchApiResponse response = webClient.get()
return webClient.get()
.uri(uriBuilder -> uriBuilder
.path("/ItemSearch.aspx")
.queryParam("Query", query)
Expand All @@ -66,13 +66,6 @@ public BookSearchApiResponse searchBooks(String query, int start) {
.retrieve()
.bodyToMono(BookSearchApiResponse.class)
.block();


if (response == null || response.getTotalResults() == 0) {
throw new BookException(ErrorCode.NOT_FOUND_SEARCH);
}

return response;
}

// 책 자동 등록
Expand Down

0 comments on commit 9943fc3

Please sign in to comment.