Skip to content

Commit

Permalink
hotfix: order ProductOrders createdDate desc
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunihs committed Sep 14, 2024
1 parent cce6726 commit 7e0a15f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface ProductOrderRepository extends JpaRepository<ProductOrder, Long
List<ProductOrder> findByIsConfirmedAndProductOrderStateIn(boolean isConfirmed, List<ProductOrderState> productOrderStates);

List<ProductOrder> findByUserId(Long userId);
Page<ProductOrder> findByUserIdAndProductOrderStateNot(Long userId, ProductOrderState productOrderState, Pageable pageable);
Page<ProductOrder> findByUserIdAndProductOrderStateNotOrderByCreatedDateDesc(Long userId, ProductOrderState productOrderState, Pageable pageable);

Page<ProductOrder> findByProductOrderStateIn(List<ProductOrderState> productOrderStates, Pageable pageable);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public PageResponse<List<GetProductOrderForUser>> getProductOrdersForUser(PageCo
User user = userRepository.findByProviderId(SecurityContextHolder.getContext().getAuthentication().getName())
.orElseThrow(() -> new CustomException(USER_NOT_FOUND));
Pageable pageable = pageCondition.toPageable();
Page<ProductOrder> productOrderPage = productOrderRepository.findByUserIdAndProductOrderStateNot(user.getId(), ProductOrderState.DEFAULT, pageable);
Page<ProductOrder> productOrderPage = productOrderRepository.findByUserIdAndProductOrderStateNotOrderByCreatedDateDesc(user.getId(), ProductOrderState.DEFAULT, pageable);
List<GetProductOrderForUser> getProductOrders = productOrderPage.stream()
.map(productOrder -> {
Product product = productRepository.findById(productOrder.getProductId())
Expand Down

0 comments on commit 7e0a15f

Please sign in to comment.