Skip to content

Comments

feat: 요청 파라미터에 기본 정렬 조건 설정 및 페이지네이션 요청 값 검증#98

Merged
dev-ant merged 4 commits intodevfrom
feat/request-default-value
Feb 17, 2026
Merged

feat: 요청 파라미터에 기본 정렬 조건 설정 및 페이지네이션 요청 값 검증#98
dev-ant merged 4 commits intodevfrom
feat/request-default-value

Conversation

@dev-ant
Copy link
Contributor

@dev-ant dev-ant commented Feb 12, 2026

📋 상세 설명

  • ItemInfo 검색에서 topCategory 필수 검증 제거 및 관련 테스트/Swagger 설명 갱신
  • 페이지 요청 DTO들의 size 제한(10~50) 및 toPageable()에서 size 보정(clamp) 로직 추가
  • 실시간 경매장 정렬 기본값을 만료일시 DESC로 변경하고 정렬 필드 enum 명칭/문서 일부 수정

📊 체크리스트

  • PR 제목이 형식에 맞나요 e.g. feat: PR을 등록한다
  • 코드가 테스트 되었나요
  • 문서는 업데이트 되었나요
  • 불필요한 코드를 제거했나요
  • 이슈와 라벨이 등록되었나요 이슈 미등록

@dev-ant dev-ant requested a review from Copilot February 12, 2026 15:25
@dev-ant dev-ant self-assigned this Feb 12, 2026
@dev-ant dev-ant added the ✨feature 새로운 기능 추가 label Feb 12, 2026
@github-actions
Copy link

github-actions bot commented Feb 12, 2026

✅ 테스트 결과 for PR

Build: success

🧪 테스트 실행 with Gradle
📈 Coverage: -0.00%

📁 테스트 결과
📁 커버리지 보고서 (HTML)

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...il/the/eternity/common/request/PageRequestDto.java 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

아이템 정보 조회 API에서 topCategory 필수 제약을 제거하고(선택 파라미터화), 페이지네이션 요청 값(size) 범위를 10~50으로 제한하며 기본 정렬/정렬 방향 기본값을 일부 조정하는 PR입니다.

Changes:

  • ItemInfo 검색에서 topCategory 필수 검증 제거 및 관련 테스트/Swagger 설명 갱신
  • 페이지 요청 DTO들의 size 제한(10~50) 및 toPageable()에서 size 보정(clamp) 로직 추가
  • 실시간 경매장 정렬 기본값을 만료일시 DESC로 변경하고 정렬 필드 enum 명칭/문서 일부 수정

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/test/java/until/the/eternity/iteminfo/application/service/ItemInfoServiceTest.java topCategory 미입력/공백 입력 시 예외 대신 조회 가능하도록 테스트 변경
src/main/java/until/the/eternity/iteminfo/interfaces/rest/dto/request/ItemInfoSearchRequest.java topCategory 필수(@notblank) 제거 및 Swagger 스키마를 선택 파라미터로 변경
src/main/java/until/the/eternity/iteminfo/interfaces/rest/dto/request/ItemInfoPageRequestDto.java size 범위 10~50으로 조정 및 toPageable()에서 size 보정 로직 추가
src/main/java/until/the/eternity/iteminfo/interfaces/rest/controller/ItemInfoController.java ItemInfo 상세/요약 조회 Swagger 설명을 “topCategory 선택” 및 페이지/정렬 조건으로 갱신
src/main/java/until/the/eternity/iteminfo/application/service/ItemInfoService.java topCategory 필수 검증 로직 제거(서비스가 조건 없이 repository로 위임)
src/main/java/until/the/eternity/common/request/PageRequestDto.java 공용 페이지 요청 size 범위를 10~50으로 변경 및 size 보정 로직 추가
src/main/java/until/the/eternity/auctionrealtime/interfaces/rest/dto/request/RealtimeSortField.java 정렬 필드 enum 상수명 변경(DATE_REGISTER → DATE_AUCTION_REGISTER)
src/main/java/until/the/eternity/auctionrealtime/interfaces/rest/dto/request/RealtimePageRequestDto.java size 범위 10~50/기본 direction DESC 반영 및 Swagger 정렬 필드 설명 수정
src/main/java/until/the/eternity/auctionrealtime/infrastructure/persistence/AuctionRealtimeQueryDslRepository.java 정렬 미지정/기본 fallback 정렬을 만료일시 DESC로 변경

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 28 to 32
public Pageable toPageable() {
int resolvedPage = this.page != null ? this.page - 1 : DEFAULT_PAGE - 1;
int resolvedSize = this.size != null ? this.size : DEFAULT_SIZE;
resolvedSize = Math.max(MIN_SIZE, Math.min(MAX_SIZE, resolvedSize));
SortField resolvedSortBy = this.sortBy != null ? this.sortBy : DEFAULT_SORT_BY;
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PageRequestDto.toPageable()에서 size를 10~50으로 강제 clamp 하고 있는데, 레코드 필드에는 @Min(10) @Max(50) 제약도 함께 있습니다. 이 DTO는 AuctionHistoryController에서 @Valid 없이 @ModelAttribute로 사용되고 있어(auctionhistory/interfaces/rest/controller/AuctionHistoryController.java:30), 실제 런타임에서는 검증 에러가 아니라 silent clamp가 적용될 수 있습니다. API가 “검증 실패로 400을 낼지” vs “범위를 자동 보정할지”를 일관되게 정하고, (1) 모든 사용처에서 @Valid를 적용하고 clamp를 제거하거나, (2) 제약 어노테이션을 제거/완화하고 자동 보정 동작을 문서에 명시하는 방향으로 정리해 주세요.

Copilot uses AI. Check for mistakes.
@Schema(
description =
"정렬 필드 (dateAuctionExpire, dateRegister, auctionPricePerUnit, itemName)",
"정렬 필드 (dateAuctionExpire, dateAuctionRegister, auctionPricePerUnit, itemName)",
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RealtimePageRequestDto의 Schema 설명에 정렬 필드로 dateAuctionRegister가 노출되어 있는데, 실제 정렬 property 및 RealtimeSortField.from() 변환은 dateRegister를 사용합니다. 현재 상태에서는 문서에 나온 값으로 요청하면 기본 정렬로 fallback 되어 사용자가 의도한 정렬이 적용되지 않습니다. 허용되는 query parameter 값 목록을 실제 변환/정렬과 동일하게 맞춰 주세요(또는 alias 지원).

Suggested change
"정렬 필드 (dateAuctionExpire, dateAuctionRegister, auctionPricePerUnit, itemName)",
"정렬 필드 (dateAuctionExpire, dateRegister, auctionPricePerUnit, itemName)",

Copilot uses AI. Check for mistakes.
Comment on lines 11 to 14
public enum RealtimeSortField {
DATE_AUCTION_EXPIRE("dateAuctionExpire", "경매 만료 일시"),
DATE_REGISTER("dateRegister", "등록 일시"),
DATE_AUCTION_REGISTER("dateRegister", "등록 일시"),
AUCTION_PRICE_PER_UNIT("auctionPricePerUnit", "개당 가격"),
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RealtimeSortField의 enum 값 이름은 DATE_AUCTION_REGISTER로 바뀌었지만, 실제 query parameter 변환은 from(String fieldName)에서 fieldName(현재 "dateRegister") 기준으로 동작합니다. 그런데 RealtimePageRequestDto의 Schema 설명은 "dateAuctionRegister"를 허용값으로 안내하고 있어, 사용자가 "dateAuctionRegister"로 요청하면 매칭되지 않고 기본값(DATE_AUCTION_EXPIRE)으로 떨어져 의도와 다른 정렬이 됩니다. 문서/변환 로직/정렬 property가 동일한 값을 쓰도록 정렬 파라미터 alias 처리(예: from()에서 dateAuctionRegister도 DATE_AUCTION_REGISTER로 매핑) 또는 Schema 허용값을 실제 fieldName("dateRegister")에 맞춰 수정해 주세요.

Copilot uses AI. Check for mistakes.
Comment on lines 52 to 56
public Page<ItemInfoResponse> findAllDetail(
ItemInfoSearchRequest searchRequest, Pageable pageable) {
validateTopCategory(searchRequest);
Page<ItemInfo> itemInfoPage =
itemInfoRepository.searchWithPagination(searchRequest, pageable);
return itemInfoPage.map(ItemInfoResponse::from);
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 ItemInfoSearchRequest에서 topCategory가 선택으로 변경되면서 null/blank 값이 서비스→레포지토리로 그대로 전달됩니다. 그런데 ItemInfoQueryDslRepository의 where 절은 문자열을 isEmpty()로만 체크하고 있어(즉, 공백 문자열은 조건으로 적용됨), 클라이언트가 실수로 공백을 보내면 “필터 미적용”이 아니라 “topCategory = ' '” 조건으로 조회되어 결과가 비정상적으로 비게 됩니다. 다른 검색 구현들처럼(blank를 미입력으로 간주) 서비스 계층에서 trim/isBlank 기반으로 null 정규화하거나, QueryDSL where 조건을 isBlank 기준으로 바꾸는 쪽으로 동작을 명확히 해주세요.

Copilot uses AI. Check for mistakes.
@dev-ant dev-ant merged commit 1a21957 into dev Feb 17, 2026
1 of 2 checks passed
@dev-ant dev-ant deleted the feat/request-default-value branch February 17, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨feature 새로운 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant