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 @@ -44,7 +44,8 @@ public OrderResponse createOrder(UUID scheduleId, UUID seatId, UUID userId) {
}

public Slice<OrderResponse> getUserOrders(UUID userId, Pageable pageable) {
Slice<Order> orders = orderRepository.findUserOrdersExcludingStatus(userId, OrderStatus.FAIL, pageable);
Slice<Order> orders = orderRepository.findUserOrdersExcludingStatus(
userId, List.of(OrderStatus.PENDING, OrderStatus.FAIL), pageable);
return orders.map(OrderResponse::from);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface OrderRepository {

Optional<Order> findByIdAndOrderStatus(UUID orderId, OrderStatus orderStatus);

boolean existsByOrderSeatSeatIdAndOrderStatusIn(UUID seatId, List<OrderStatus> pending);
boolean existsByOrderSeatSeatIdAndOrderStatusIn(UUID seatId, List<OrderStatus> statuses);

Slice<Order> findUserOrdersExcludingStatus(UUID userId, OrderStatus orderStatus, Pageable pageable);
Slice<Order> findUserOrdersExcludingStatus(UUID userId, List<OrderStatus> statuses, Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.UUID;

public interface OrderJpaRepository extends OrderRepository, JpaRepository<Order, UUID> {
@Query("SELECT o FROM Order o " +
"JOIN FETCH o.orderSeat " +
"JOIN FETCH o.orderSeat os " +
"WHERE o.userId = :userId " +
"AND o.orderStatus != :orderStatus")
Slice<Order> findUserOrdersExcludingStatus(UUID userId, OrderStatus orderStatus, Pageable pageable);
"AND o.orderStatus NOT IN :statuses")
Slice<Order> findUserOrdersExcludingStatus(UUID userId, List<OrderStatus> statuses, Pageable pageable);
}
Loading