Skip to content

Commit

Permalink
[BE] FIX: ItemHistoryQueryService 메서드명 find로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
chyo1 committed Jun 4, 2024
1 parent 2c1a0d7 commit fa8ea41
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void assignItem(List<Long> userIds, Sku sku) {
@Transactional(readOnly = true)
public AdminItemHistoryPaginationDto getUserItemHistories(Long userId, Pageable pageable) {
Page<ItemHistory> itemHistoryWithItem =
itemHistoryQueryService.getItemHistoriesByUserIdWithItem(userId, pageable);
itemHistoryQueryService.findItemHistoriesByUserIdWithItem(userId, pageable);

List<AdminItemHistoryDto> result = itemHistoryWithItem.stream()
.map(ih -> itemMapper.toAdminItemHistoryDto(ih, ih.getItem()))
Expand All @@ -66,7 +66,7 @@ public ItemStatisticsDto getItemPurchaseStatistics() {
List<Item> itemsOnSale = itemQueryService.getUseItemIds();
List<ItemPurchaseCountDto> result = itemsOnSale.stream()
.map(item -> {
int userCount = itemHistoryQueryService.getPurchaseCountByItemId(item.getId());
int userCount = itemHistoryQueryService.findPurchaseCountByItemId(item.getId());
return itemMapper.toItemPurchaseCountDto(item, userCount);
}).collect(Collectors.toList());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public OverdueUserCabinetPaginationDto getOverdueUsers(Pageable pageable) {
public CoinCollectStatisticsDto getCoinCollectCountByMonth(Integer year, Integer month) {
Long itemId = itemQueryService.getBySku(COIN_COLLECT).getId();
List<ItemHistory> coinCollectedInfoByMonth =
itemHistoryQueryService.getCoinCollectedInfoByMonth(itemId, year, month);
itemHistoryQueryService.findCoinCollectedInfoByMonth(itemId, year, month);
Map<Long, Long> coinCollectCountByUser = coinCollectedInfoByMonth.stream()
.collect(groupingBy(ItemHistory::getUserId, Collectors.counting()));

Expand Down Expand Up @@ -196,7 +196,7 @@ public CoinStaticsDto getCoinStaticsDto(LocalDate startDate, LocalDate endDate)
});

List<ItemHistory> usedCoins =
itemHistoryQueryService.getUsedCoinHistoryBetween(startDate,
itemHistoryQueryService.findUsedCoinHistoryBetween(startDate,
endDate);

usedCoins.forEach(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public MyItemResponseDto getMyItems(UserSessionDto user) {
@Transactional(readOnly = true)
public ItemHistoryPaginationDto getItemHistory(Long userId, Pageable pageable) {
Page<ItemHistory> itemHistories =
itemHistoryQueryService.getItemHistoryWithItem(userId, pageable);
itemHistoryQueryService.findItemHistoryWithItem(userId, pageable);
List<ItemHistoryDto> result = itemHistories.stream()
.map(ih -> itemMapper.toItemHistoryDto(ih, itemMapper.toItemDto(ih.getItem())))
.collect(Collectors.toList());
Expand All @@ -143,7 +143,7 @@ public CoinHistoryPaginationDto getCoinHistory(Long userId, CoinHistoryType type
}
List<Long> itemIds = items.stream().map(Item::getId).collect(Collectors.toList());
Page<ItemHistory> coinHistories =
itemHistoryQueryService.getCoinHistory(userId, pageable, itemIds);
itemHistoryQueryService.findCoinHistory(userId, pageable, itemIds);

Map<Long, Item> itemMap = items.stream()
.collect(Collectors.toMap(Item::getId, item -> item));
Expand Down Expand Up @@ -240,7 +240,7 @@ public void useItem(Long userId, Sku sku, ItemUseRequestDto data) {
}
Item item = itemQueryService.getBySku(sku);
List<ItemHistory> itemInInventory =
itemHistoryQueryService.getUnusedItemsInUserInventory(user.getId(), item.getId());
itemHistoryQueryService.findUnusedItemsInUserInventory(user.getId(), item.getId());
ItemHistory firstItem = itemPolicyService.verifyEmptyItems(itemInInventory);
ItemUsage itemUsage = getItemUsage(userId, item, data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,33 @@ public List<ItemHistory> findAllItemHistoryByUser(Long userId) {
return itemHistoryRepository.getAllUnusedItemHistoryByUser(userId);
}

public Page<ItemHistory> getItemHistoryWithItem(Long userId, Pageable pageable) {
public Page<ItemHistory> findItemHistoryWithItem(Long userId, Pageable pageable) {
return itemHistoryRepository.findAllByUserIdOnMinusPriceItemsWithSubQuery(userId, pageable);
}

public Page<ItemHistory> getItemHistoriesByUserIdWithItem(Long userId, Pageable pageable) {
public Page<ItemHistory> findItemHistoriesByUserIdWithItem(Long userId, Pageable pageable) {
return itemHistoryRepository.findAllByUserIdOrderByPurchaseAtDesc(userId, pageable);
}

public Page<ItemHistory> getCoinHistory(Long userId, Pageable pageable, List<Long> itemIds) {
public Page<ItemHistory> findCoinHistory(Long userId, Pageable pageable, List<Long> itemIds) {
return itemHistoryRepository.findAllByUserIdAndItemIdIn(userId, pageable, itemIds);
}

public List<ItemHistory> getUnusedItemsInUserInventory(Long userId, Long itemId) {
public List<ItemHistory> findUnusedItemsInUserInventory(Long userId, Long itemId) {
return itemHistoryRepository.findAllByUserIdAndItemIdAndUsedAtIsNull(userId, itemId);
}

public int getPurchaseCountByItemId(Long itemId) {
public int findPurchaseCountByItemId(Long itemId) {
return itemHistoryRepository.getCountByItemIds(itemId);
}

public List<ItemHistory> getUsedCoinHistoryBetween(
public List<ItemHistory> findUsedCoinHistoryBetween(
LocalDate startDate,
LocalDate endDate) {
return itemHistoryRepository.findAllUsedAtIsNotNullBetween(startDate, endDate);
}

public List<ItemHistory> getCoinCollectedInfoByMonth(Long itemId, Integer year,
public List<ItemHistory> findCoinCollectedInfoByMonth(Long itemId, Integer year,
Integer month) {
return itemHistoryRepository.findCoinCollectInfoByIdAtYearAndMonth(itemId, year, month);
}
Expand Down

0 comments on commit fa8ea41

Please sign in to comment.