Skip to content

Commit

Permalink
🔨 Refactor/#62 - OnjungTag Controller 반영 (#63)
Browse files Browse the repository at this point in the history
* ♻️ refactor/#62 : onjungTags default값 변경

Signed-off-by: EunJiJung <[email protected]>

* ♻️ refactor/#62 : print문 제거

Signed-off-by: EunJiJung <[email protected]>

---------

Signed-off-by: EunJiJung <[email protected]>
  • Loading branch information
bianbbc87 authored Nov 22, 2024
1 parent a4c295b commit a056c83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public ResponseDto<ReadStoreOverviewsResponseDto> readStoreList(
@RequestParam(value = "page") Integer page,
@RequestParam(value = "size") Integer size,
@RequestParam(value = "search", required = false) String title,
@RequestParam(value = "onjungTags", required = false, defaultValue = "PATRIOT,GOOD_PRICE,UNDERFED_CHILD") String onjungTags,
@RequestParam(value = "onjungTags", required = false, defaultValue = "DISABLED_GROUP,GOOD_PRICE,UNDERFED_CHILD") String onjungTags,
@RequestParam(value = "sortByOnjungCount", required = false, defaultValue = "desc") String sortByOnjungCount
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ public ReadStoreOverviewsResponseDto execute(
// 페이지네이션
int start = (int) pageable.getOffset();
int end = Math.min(start + pageable.getPageSize(), storeOverviewDtos.size());

// 페이지 범위가 유효한지 확인
if (start >= storeOverviewDtos.size()) {
// start가 list의 크기보다 크면 빈 리스트를 반환
return ReadStoreOverviewsResponseDto.fromEntity(
List.of(),
false // hasNext 계산
);
}

List<ReadStoreOverviewsResponseDto.StoreOverviewDto> pagedStoreOverviewDtos = storeOverviewDtos.subList(start, end);

// 응답 생성
Expand Down

0 comments on commit a056c83

Please sign in to comment.