Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#109] 검색 Pageable수정 #110

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import kopis.k_backend.search.service.SearchService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -37,9 +38,10 @@ public class SearchController {
})
@GetMapping(value = "/home")
public ApiResponse<HomeSearchResDto> getHomeSearchResults(
@RequestParam final String query,
@PageableDefault final Pageable pageable
@RequestParam final String query
){
Pageable pageable = PageRequest.of(0, 50);

final HomeSearchResDto homeSearchResDto = searchService.getHomeSearchResDto(query, pageable);
return ApiResponse.onSuccess(SuccessCode.SEARCH_HOME_SUCCESS, homeSearchResDto);
}
Expand All @@ -49,14 +51,15 @@ public ApiResponse<HomeSearchResDto> getHomeSearchResults(
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "SEARCH_2002", description = "공연 이름에 따른 페어 목록 반환 완료했습니다.")
})
@Parameters({
@Parameter(name = "query", description = "조회하고 싶은 공연 이름의 부분 문자열"),
@Parameter(name = "pageable", description = "이 메서드에서 size는 한 번에 검색되는 공연 수입니다.")
@Parameter(name = "query", description = "조회하고 싶은 공연 이름의 부분 문자열")
})
@GetMapping(value = "pairs/performance")
public ApiResponse<PairSearchResDto> getPairSearchResults(
@RequestParam final String query,
@PageableDefault final Pageable pageable
@RequestParam final String query
){
// pageSize: 한 번에 검색되는 공연 수
Pageable pageable = PageRequest.of(0, 5);

final List<Performance> performanceList = searchService.getPerformanceList(query, pageable);
return ApiResponse.onSuccess(SuccessCode.SEARCH_PAIR_SUCCESS, searchService.getPairSearchResDto(performanceList));
}
Expand Down
Loading