Skip to content

Commit

Permalink
Api-v1.0.0-2
Browse files Browse the repository at this point in the history
Api-v1.0.0-2
  • Loading branch information
ImNM authored Feb 27, 2023
2 parents b38302c + d35b7c9 commit 0e2e8d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ public List<Order> findByEventId(Long eventId) {
return orderRepository.findByEventId(eventId);
}

public List<Order> findByEventIdAndOrderStatus(Long eventId, OrderStatus orderStatus) {
return orderRepository.findByEventIdAndOrderStatus(eventId, orderStatus);
}

public Order findByOrderUuid(String uuid) {
return orderRepository
.findByOrderUuid(uuid)
Expand All @@ -60,4 +56,9 @@ public Slice<Order> findMyOrders(FindMyPageOrderCondition condition, Pageable pa
public Page<Order> findEventOrders(FindEventOrdersCondition condition, Pageable pageable) {
return orderRepository.findEventOrders(condition, pageable);
}

public List<Order> findByEventIdAndOrderStatusAndUserId(
Long eventId, Long userId, OrderStatus orderStatus) {
return orderRepository.findByEventIdAndUserIdAndOrderStatus(eventId, userId, orderStatus);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,12 @@ public void validItemPurchaseLimit(Order order, TicketItem item) {
public void validApproveStatePurchaseLimit(Order order) {
TicketItem item = getItem(order);
// 이미 발급된 티켓 개수
Long paidTicketCount = issuedTicketAdaptor.countPaidTicket(order.getUserId(), item.getId());
Long userId = order.getUserId();
Long paidTicketCount = issuedTicketAdaptor.countPaidTicket(userId, item.getId());

List<Order> approveWaitingOrders =
orderAdaptor.findByEventIdAndOrderStatus(
order.getEventId(), OrderStatus.PENDING_APPROVE);
orderAdaptor.findByEventIdAndOrderStatusAndUserId(
order.getEventId(), userId, OrderStatus.PENDING_APPROVE);
// 승인 대기중인 티켓 개수
Long approveWaitingTicketCount =
approveWaitingOrders.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public interface OrderRepository extends CrudRepository<Order, Long>, OrderCusto

List<Order> findByEventId(Long eventId);

List<Order> findByEventIdAndOrderStatus(Long eventId, OrderStatus orderStatus);
List<Order> findByEventIdAndUserIdAndOrderStatus(
Long eventId, Long userId, OrderStatus orderStatus);

List<Order> findByUuidIn(List<String> uuids);
}

0 comments on commit 0e2e8d3

Please sign in to comment.