Skip to content
Merged
Show file tree
Hide file tree
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 @@ -20,24 +20,24 @@ public class ItemDailyStatisticsService {
private final ItemDailyStatisticsRepository repository;
private final ItemDailyStatisticsMapper mapper;

/** 아이템별 일간 통계 전체 조회 (페이징) */
/** 아이템별 일간 통계 조회 (itemName, subCategory, topCategory, 날짜 범위) */
@Transactional(readOnly = true)
public PageResponseDto<ItemDailyStatisticsResponse> findAll(Pageable pageable) {
Page<ItemDailyStatistics> page = repository.findAll(pageable);
Page<ItemDailyStatisticsResponse> dtoPage = page.map(mapper::toDto);
return PageResponseDto.of(dtoPage);
}
public java.util.List<ItemDailyStatisticsResponse> search(
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The new search method lacks test coverage. The existing tests only cover findAll and findById which have been removed. Add tests for the search method including validation and query scenarios.

Copilot uses AI. Check for mistakes.
String itemName,
String subCategory,
String topCategory,
java.time.LocalDate startDate,
java.time.LocalDate endDate) {
Comment on lines +25 to +30
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The code uses fully qualified class names (java.util.List, java.time.LocalDate) instead of importing them. Add proper imports and use simple class names for better readability.

Copilot uses AI. Check for mistakes.
// 날짜 범위 검증 (최대 30일)
until.the.eternity.statistics.util.DateRangeValidator.validateDailyDateRange(
startDate, endDate);

/** 아이템별 일간 통계 ID로 단건 조회 */
@Transactional(readOnly = true)
public ItemDailyStatisticsResponse findById(Long id) {
ItemDailyStatistics entity =
repository
.findById(id)
.orElseThrow(
() ->
new IllegalArgumentException(
"ItemDailyStatistics not found: " + id));
return mapper.toDto(entity);
// 조회
java.util.List<ItemDailyStatistics> results =
repository.findByItemAndDateRange(
itemName, subCategory, topCategory, startDate, endDate);

// DTO 변환
return results.stream().map(mapper::toDto).collect(java.util.stream.Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ public class ItemWeeklyStatisticsService {
private final ItemWeeklyStatisticsRepository repository;
private final ItemWeeklyStatisticsMapper mapper;

/** 아이템별 주간 통계 전체 조회 (페이징) */
/** 아이템별 주간 통계 조회 (itemName, subCategory, topCategory, 날짜 범위) */
@Transactional(readOnly = true)
public PageResponseDto<ItemWeeklyStatisticsResponse> findAll(Pageable pageable) {
Page<ItemWeeklyStatistics> page = repository.findAll(pageable);
Page<ItemWeeklyStatisticsResponse> dtoPage = page.map(mapper::toDto);
return PageResponseDto.of(dtoPage);
}
public java.util.List<ItemWeeklyStatisticsResponse> search(
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The new search method lacks test coverage. Add tests for the search method including validation and query scenarios.

Copilot uses AI. Check for mistakes.
String itemName,
String subCategory,
String topCategory,
java.time.LocalDate startDate,
java.time.LocalDate endDate) {
Comment on lines +25 to +30
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The code uses fully qualified class names (java.util.List, java.time.LocalDate) instead of importing them. Add proper imports and use simple class names for better readability.

Copilot uses AI. Check for mistakes.
// 날짜 범위 검증 (최대 4개월)
until.the.eternity.statistics.util.DateRangeValidator.validateWeeklyDateRange(
startDate, endDate);

/** 아이템별 주간 통계 ID로 단건 조회 */
@Transactional(readOnly = true)
public ItemWeeklyStatisticsResponse findById(Long id) {
ItemWeeklyStatistics entity =
repository
.findById(id)
.orElseThrow(
() ->
new IllegalArgumentException(
"ItemWeeklyStatistics not found: " + id));
return mapper.toDto(entity);
// 조회
java.util.List<ItemWeeklyStatistics> results =
repository.findByItemAndDateRange(
itemName, subCategory, topCategory, startDate, endDate);

// DTO 변환
return results.stream().map(mapper::toDto).collect(java.util.stream.Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,22 @@ public class SubcategoryDailyStatisticsService {
private final SubcategoryDailyStatisticsRepository repository;
private final SubcategoryDailyStatisticsMapper mapper;

/** 서브카테고리별 일간 통계 전체 조회 (페이징) */
/** 서브카테고리별 일간 통계 조회 (subCategory, 날짜 범위) */
@Transactional(readOnly = true)
public PageResponseDto<SubcategoryDailyStatisticsResponse> findAll(Pageable pageable) {
Page<SubcategoryDailyStatistics> page = repository.findAll(pageable);
Page<SubcategoryDailyStatisticsResponse> dtoPage = page.map(mapper::toDto);
return PageResponseDto.of(dtoPage);
}
public java.util.List<SubcategoryDailyStatisticsResponse> search(
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The new search method lacks test coverage. Add tests for the search method including validation and query scenarios.

Copilot uses AI. Check for mistakes.
String topCategory, // topCategory는 파라미터로 받지만 조회에는 사용하지 않음 (DB 구조상)
String subCategory,
java.time.LocalDate startDate,
java.time.LocalDate endDate) {
Comment on lines +25 to +29
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The topCategory parameter is accepted but not used in the database query. This creates a confusing API. Either remove the parameter entirely, or validate it against the returned results if topCategory is important for API consistency.

Copilot uses AI. Check for mistakes.
// 날짜 범위 검증 (최대 30일)
until.the.eternity.statistics.util.DateRangeValidator.validateDailyDateRange(
startDate, endDate);

/** 서브카테고리별 일간 통계 ID로 단건 조회 */
@Transactional(readOnly = true)
public SubcategoryDailyStatisticsResponse findById(Long id) {
SubcategoryDailyStatistics entity =
repository
.findById(id)
.orElseThrow(
() ->
new IllegalArgumentException(
"SubcategoryDailyStatistics not found: " + id));
return mapper.toDto(entity);
// 조회
java.util.List<SubcategoryDailyStatistics> results =
repository.findBySubcategoryAndDateRange(subCategory, startDate, endDate);

// DTO 변환
return results.stream().map(mapper::toDto).collect(java.util.stream.Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,22 @@ public class SubcategoryWeeklyStatisticsService {
private final SubcategoryWeeklyStatisticsRepository repository;
private final SubcategoryWeeklyStatisticsMapper mapper;

/** 서브카테고리별 주간 통계 전체 조회 (페이징) */
/** 서브카테고리별 주간 통계 조회 (subCategory, 날짜 범위) */
@Transactional(readOnly = true)
public PageResponseDto<SubcategoryWeeklyStatisticsResponse> findAll(Pageable pageable) {
Page<SubcategoryWeeklyStatistics> page = repository.findAll(pageable);
Page<SubcategoryWeeklyStatisticsResponse> dtoPage = page.map(mapper::toDto);
return PageResponseDto.of(dtoPage);
}
public java.util.List<SubcategoryWeeklyStatisticsResponse> search(
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The new search method lacks test coverage. Add tests for the search method including validation and query scenarios.

Copilot uses AI. Check for mistakes.
String topCategory, // topCategory는 파라미터로 받지만 조회에는 사용하지 않음 (DB 구조상)
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The topCategory parameter is accepted but not used in the database query. This creates a confusing API. Either remove the parameter entirely, or validate it against the returned results if topCategory is important for API consistency.

Suggested change
String topCategory, // topCategory는 파라미터로 받지만 조회에는 사용하지 않음 (DB 구조상)

Copilot uses AI. Check for mistakes.
String subCategory,
java.time.LocalDate startDate,
java.time.LocalDate endDate) {
// 날짜 범위 검증 (최대 4개월)
until.the.eternity.statistics.util.DateRangeValidator.validateWeeklyDateRange(
startDate, endDate);

/** 서브카테고리별 주간 통계 ID로 단건 조회 */
@Transactional(readOnly = true)
public SubcategoryWeeklyStatisticsResponse findById(Long id) {
SubcategoryWeeklyStatistics entity =
repository
.findById(id)
.orElseThrow(
() ->
new IllegalArgumentException(
"SubcategoryWeeklyStatistics not found: " + id));
return mapper.toDto(entity);
// 조회
java.util.List<SubcategoryWeeklyStatistics> results =
repository.findBySubcategoryAndDateRange(subCategory, startDate, endDate);

// DTO 변환
return results.stream().map(mapper::toDto).collect(java.util.stream.Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,19 @@ public class TopCategoryDailyStatisticsService {
private final TopCategoryDailyStatisticsRepository repository;
private final TopCategoryDailyStatisticsMapper mapper;

/** 탑카테고리별 일간 통계 전체 조회 (페이징) */
/** 탑카테고리별 일간 통계 조회 (topCategory, 날짜 범위) */
@Transactional(readOnly = true)
public PageResponseDto<TopCategoryDailyStatisticsResponse> findAll(Pageable pageable) {
Page<TopCategoryDailyStatistics> page = repository.findAll(pageable);
Page<TopCategoryDailyStatisticsResponse> dtoPage = page.map(mapper::toDto);
return PageResponseDto.of(dtoPage);
}
public java.util.List<TopCategoryDailyStatisticsResponse> search(
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The new search method lacks test coverage. Add tests for the search method including validation and query scenarios.

Copilot uses AI. Check for mistakes.
String topCategory, java.time.LocalDate startDate, java.time.LocalDate endDate) {
// 날짜 범위 검증 (최대 30일)
until.the.eternity.statistics.util.DateRangeValidator.validateDailyDateRange(
Comment on lines +25 to +28
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The code uses fully qualified class names (java.util.List, java.time.LocalDate, until.the.eternity.statistics.util.DateRangeValidator) instead of importing them. Add proper imports and use simple class names for better readability.

Copilot uses AI. Check for mistakes.
startDate, endDate);

/** 탑카테고리별 일간 통계 ID로 단건 조회 */
@Transactional(readOnly = true)
public TopCategoryDailyStatisticsResponse findById(Long id) {
TopCategoryDailyStatistics entity =
repository
.findById(id)
.orElseThrow(
() ->
new IllegalArgumentException(
"TopCategoryDailyStatistics not found: " + id));
return mapper.toDto(entity);
// 조회
java.util.List<TopCategoryDailyStatistics> results =
repository.findByTopCategoryAndDateRange(topCategory, startDate, endDate);

// DTO 변환
return results.stream().map(mapper::toDto).collect(java.util.stream.Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,19 @@ public class TopCategoryWeeklyStatisticsService {
private final TopCategoryWeeklyStatisticsRepository repository;
private final TopCategoryWeeklyStatisticsMapper mapper;

/** 탑카테고리별 주간 통계 전체 조회 (페이징) */
/** 탑카테고리별 주간 통계 조회 (topCategory, 날짜 범위) */
@Transactional(readOnly = true)
public PageResponseDto<TopCategoryWeeklyStatisticsResponse> findAll(Pageable pageable) {
Page<TopCategoryWeeklyStatistics> page = repository.findAll(pageable);
Page<TopCategoryWeeklyStatisticsResponse> dtoPage = page.map(mapper::toDto);
return PageResponseDto.of(dtoPage);
}
public java.util.List<TopCategoryWeeklyStatisticsResponse> search(
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The new search method lacks test coverage. The existing tests only cover findById which has been removed. Add tests for the search method including validation and query scenarios.

Copilot uses AI. Check for mistakes.
String topCategory, java.time.LocalDate startDate, java.time.LocalDate endDate) {
// 날짜 범위 검증 (최대 4개월)
until.the.eternity.statistics.util.DateRangeValidator.validateWeeklyDateRange(
Comment on lines +25 to +28
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The code uses fully qualified class names (java.util.List, java.time.LocalDate, until.the.eternity.statistics.util.DateRangeValidator) instead of importing them. Add proper imports and use simple class names for better readability.

Copilot uses AI. Check for mistakes.
startDate, endDate);

/** 탑카테고리별 주간 통계 ID로 단건 조회 */
@Transactional(readOnly = true)
public TopCategoryWeeklyStatisticsResponse findById(Long id) {
TopCategoryWeeklyStatistics entity =
repository
.findById(id)
.orElseThrow(
() ->
new IllegalArgumentException(
"TopCategoryWeeklyStatistics not found: " + id));
return mapper.toDto(entity);
// 조회
java.util.List<TopCategoryWeeklyStatistics> results =
repository.findByTopCategoryAndDateRange(topCategory, startDate, endDate);

// DTO 변환
return results.stream().map(mapper::toDto).collect(java.util.stream.Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ public class ItemDailyStatistics {
@Schema(description = "아이템 이름", example = "켈틱 로열 나이트 소드")
private String itemName;

@Column(name = "item_top_category", nullable = false, length = 255)
@Schema(description = "아이템 탑 카테고리", example = "무기")
private String itemTopCategory;

@Column(name = "item_sub_category", nullable = false, length = 255)
@Schema(description = "아이템 서브 카테고리", example = "한손검")
private String itemSubCategory;

@Column(name = "date_auction_buy", nullable = false)
@Schema(description = "거래 일자", example = "2025-07-01")
private LocalDate dateAuctionBuy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ public class ItemWeeklyStatistics {
@Schema(description = "아이템 이름", example = "켈틱 로열 나이트 소드")
private String itemName;

@Column(name = "item_top_category", nullable = false, length = 255)
@Schema(description = "아이템 탑 카테고리", example = "무기")
private String itemTopCategory;

@Column(name = "item_sub_category", nullable = false, length = 255)
@Schema(description = "아이템 서브 카테고리", example = "한손검")
private String itemSubCategory;

@Column(name = "year", nullable = false)
@Schema(description = "연도", example = "2025")
private Integer year;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import until.the.eternity.common.request.PageRequestDto;
import until.the.eternity.common.response.PageResponseDto;
import until.the.eternity.statistics.application.service.ItemDailyStatisticsService;
import until.the.eternity.statistics.interfaces.rest.dto.request.ItemDailyStatisticsSearchRequest;
import until.the.eternity.statistics.interfaces.rest.dto.response.ItemDailyStatisticsResponse;

@RestController
Expand All @@ -22,19 +24,20 @@ public class ItemDailyStatisticsController {

@GetMapping
@Operation(
summary = "아이템별 일간 통계 목록 조회",
description = "아이템별 일간 거래 통계 목록을 페이징하여 조회합니다. 최저가, 최고가, 평균가, 거래 총량, 거래 수량 정보를 포함합니다.")
public ResponseEntity<PageResponseDto<ItemDailyStatisticsResponse>> getItemDailyStatistics(
@ParameterObject @ModelAttribute PageRequestDto pageDto) {
PageResponseDto<ItemDailyStatisticsResponse> result = service.findAll(pageDto.toPageable());
return ResponseEntity.ok(result);
}

@GetMapping("/{id}")
@Operation(summary = "아이템별 일간 통계 단건 조회", description = "ID를 통해 특정 아이템의 일간 거래 통계를 조회합니다.")
public ResponseEntity<ItemDailyStatisticsResponse> getItemDailyStatisticsById(
@Parameter(description = "통계 ID", example = "1") @PathVariable Long id) {
ItemDailyStatisticsResponse result = service.findById(id);
return ResponseEntity.ok(result);
summary = "아이템별 일간 통계 조회",
description = "아이템 이름, 서브 카테고리, 탑 카테고리로 일간 통계를 조회합니다. 최대 30일까지 조회 가능합니다.")
public ResponseEntity<java.util.List<ItemDailyStatisticsResponse>> searchItemDailyStatistics(
@ParameterObject @ModelAttribute
@Valid
ItemDailyStatisticsSearchRequest
request) {
java.util.List<ItemDailyStatisticsResponse> results =
service.search(
request.itemName(),
request.subCategory(),
request.topCategory(),
request.getStartDateWithDefault(),
request.getEndDateWithDefault());
return ResponseEntity.ok(results);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,20 @@ public class ItemWeeklyStatisticsController {

@GetMapping
@Operation(
summary = "아이템별 주간 통계 목록 조회",
description =
"아이템별 주간 거래 통계 목록을 페이징하여 조회합니다. 최저가, 최고가, 평균가, 거래 총량, 거래 수량, 연도, 주차 정보를 포함합니다.")
public ResponseEntity<PageResponseDto<ItemWeeklyStatisticsResponse>> getItemWeeklyStatistics(
@ParameterObject @ModelAttribute PageRequestDto pageDto) {
PageResponseDto<ItemWeeklyStatisticsResponse> result =
service.findAll(pageDto.toPageable());
return ResponseEntity.ok(result);
}

@GetMapping("/{id}")
@Operation(summary = "아이템별 주간 통계 단건 조회", description = "ID를 통해 특정 아이템의 주간 거래 통계를 조회합니다.")
public ResponseEntity<ItemWeeklyStatisticsResponse> getItemWeeklyStatisticsById(
@Parameter(description = "통계 ID", example = "1") @PathVariable Long id) {
ItemWeeklyStatisticsResponse result = service.findById(id);
return ResponseEntity.ok(result);
summary = "아이템별 주간 통계 조회",
description = "아이템 이름, 서브 카테고리, 탑 카테고리로 주간 통계를 조회합니다. 최대 4개월까지 조회 가능합니다.")
public ResponseEntity<java.util.List<ItemWeeklyStatisticsResponse>> searchItemWeeklyStatistics(
@ParameterObject @ModelAttribute
@jakarta.validation.Valid
until.the.eternity.statistics.interfaces.rest.dto.request.ItemWeeklyStatisticsSearchRequest
Comment on lines +27 to +30
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The code uses fully qualified class names (java.util.List, jakarta.validation.Valid, until.the.eternity.statistics.interfaces.rest.dto.request.ItemWeeklyStatisticsSearchRequest) instead of importing them. Add proper imports and use simple class names for better readability.

Copilot uses AI. Check for mistakes.
request) {
java.util.List<ItemWeeklyStatisticsResponse> results =
service.search(
request.itemName(),
request.subCategory(),
request.topCategory(),
request.getStartDateWithDefault(),
request.getEndDateWithDefault());
return ResponseEntity.ok(results);
}
}
Loading