Skip to content

Conversation

@dev-ant
Copy link
Contributor

@dev-ant dev-ant commented Nov 6, 2025

📋 상세 설명

  • 경매 내역 검색 기능을 강화, 구조화된 검색 요청 DTO와 타입 안정(enum 기반) 정렬·필터링 도입
    • 문자열(String) 기반 파라미터를 타입 안전 enum(SortField, SortDirection, SearchStandard)으로 교체
    • 검색 요청 구조를 price, date, item options 등의 중첩 DTO 형태로 재구성
    • 서브쿼리 및 GROUP BY/HAVING 절을 이용한 복합 옵션 필터링 로직 강화
  • 테스트 코드에서 와일드카드 import 제거 후 명시적 Mockito import로 변경

📊 체크리스트

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

📆 마감일

Close #71

@dev-ant dev-ant requested a review from Copilot November 6, 2025 14:57
@dev-ant dev-ant self-assigned this Nov 6, 2025
@dev-ant dev-ant added the ✨feature 새로운 기능 추가 label Nov 6, 2025
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

✅ 테스트 결과 for PR

Build: success

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

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

@codecov
Copy link

codecov bot commented Nov 6, 2025

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

This PR refactors the auction history search functionality by introducing structured search request DTOs and type-safe enums for sorting and filtering. The changes improve API design by replacing String-based parameters with strongly-typed enums and nested request objects for better validation and maintainability.

Key changes:

  • Introduced type-safe enums (SortField, SortDirection, SearchStandard) to replace String-based parameters
  • Refactored search request structure into nested DTOs for better organization (price, date, item options)
  • Enhanced query logic with complex option filtering using subqueries and GROUP BY/HAVING clauses
  • Replaced wildcard import with specific Mockito imports in test files

Reviewed Changes

Copilot reviewed 32 out of 33 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
PageRequestDto.java Changed sortBy and direction from String to enum types (SortField, SortDirection)
SortField.java New enum for type-safe sort field values with Jackson JSON mapping
SortDirection.java New enum for ASC/DESC direction with Spring Data conversion
SearchStandard.java New enum for UP/DOWN/EQUAL comparison operators
AuctionHistorySearchRequest.java Restructured to use nested request DTOs instead of flat String fields
PriceSearchRequest.java Fixed parameter naming (PriceTo/PriceFrom → priceFrom/priceTo) and changed primitive to Long
Multiple *SearchRequest.java New request DTOs for structured item option search criteria
AuctionHistoryQueryDslRepository.java Major refactoring with subquery-based option filtering and dynamic sorting
AuctionHistoryController.java Added @ParameterObject annotation for Swagger documentation
MetalwareInfoServiceTest.java Replaced wildcard Mockito import with specific imports
AuctionHistoryServiceTest.java Updated test to match new AuctionHistorySearchRequest constructor
Comments suppressed due to low confidence (1)

src/main/java/until/the/eternity/auctionhistory/interfaces/rest/dto/enums/SortDirection.java:1

  • [nitpick] The from method handles null input by returning a default value, but this duplicates the null handling logic that exists in PageRequestDto.toPageable() (lines 31-32). Consider removing the null check here since the calling code already handles null values, making this method's responsibility clearer - it should only parse non-null strings.
package until.the.eternity.auctionhistory.interfaces.rest.dto.enums;

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

public String getDescription() {
return description;
}

Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The from method serves as both a @JsonCreator for JSON deserialization and a general factory method. Consider adding a JavaDoc comment to clarify this dual purpose and document the behavior when an invalid code is provided (returns DESC as default).

Suggested change
/**
* Factory method for converting a string code to a {@link SortDirection} enum.
* <p>
* This method serves as both a general factory and as a {@link JsonCreator} for JSON deserialization.
* If the provided code does not match any known direction (case-insensitive), {@code DESC} is returned as the default.
*
* @param code the string code representing the sort direction
* @return the corresponding {@link SortDirection}, or {@code DESC} if the code is invalid
*/

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +41
@JsonCreator
public static SortDirection from(String code) {
if (code == null) {
return DESC; // 기본값: 내림차순
}
return Arrays.stream(SortDirection.values())
.filter(direction -> direction.code.equalsIgnoreCase(code))
.findFirst()
.orElse(DESC);
}
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

This is a duplicate enum class. Both until.the.eternity.common.enums.SortDirection and until.the.eternity.auctionhistory.interfaces.rest.dto.enums.SortDirection exist with identical implementations. The common enum should be used throughout the codebase to avoid duplication and potential inconsistencies.

Copilot uses AI. Check for mistakes.
if (date.dateAuctionBuyFrom() != null && !date.dateAuctionBuyFrom().isBlank()) {
Instant fromInstant =
LocalDate.parse(date.dateAuctionBuyFrom())
.atStartOfDay(ZoneId.systemDefault())
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Using ZoneId.systemDefault() can lead to inconsistent behavior across different server environments. Consider using a fixed timezone (e.g., ZoneId.of(\"UTC\") or ZoneId.of(\"Asia/Seoul\")) for consistent date handling across deployments.

Copilot uses AI. Check for mistakes.
Instant toInstant =
LocalDate.parse(date.dateAuctionBuyTo())
.plusDays(1)
.atStartOfDay(ZoneId.systemDefault())
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Using ZoneId.systemDefault() can lead to inconsistent behavior across different server environments. Consider using a fixed timezone (e.g., ZoneId.of(\"UTC\") or ZoneId.of(\"Asia/Seoul\")) for consistent date handling across deployments.

Copilot uses AI. Check for mistakes.
Comment on lines +410 to +411
return Expressions.numberTemplate(
Integer.class, "COALESCE({0}, {1}, 0)", aio.optionValue2, aio.optionValue);
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The castOptionValueToInt method name is misleading - it doesn't cast but rather uses COALESCE to select the first non-null value. Consider renaming to getOptionValueAsInt or coalesceOptionValue to better reflect its actual behavior. Also add a JavaDoc explaining why it checks optionValue2 first before falling back to optionValue.

Copilot uses AI. Check for mistakes.
Comment on lines +203 to +207
// 에르그는 레벨/랭크 통합하여 1개로 카운트
if (!ergConditionAdded) {
conditionCount++;
ergConditionAdded = true;
}
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

[nitpick] The logic for preventing duplicate counting of erg conditions (level and rank) requires a boolean flag tracked across multiple if-blocks. Consider extracting erg condition building into a separate method that returns an Optional to encapsulate this logic and make the code more maintainable.

Copilot uses AI. Check for mistakes.
@dev-ant dev-ant merged commit da46b4c into dev Nov 6, 2025
7 of 8 checks passed
@dev-ant dev-ant deleted the feat/auction-option-search branch November 6, 2025 15:10
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.

경매장 거래 내역 옵션 검색 기능 구현

2 participants