Skip to content

Commit

Permalink
Merge pull request #73 from ClothingStoreService/hotfix/order-QueryDSL
Browse files Browse the repository at this point in the history
hotfix: 판매자 주문 조회 QueryDSL 관련 오류 수정
  • Loading branch information
axhtl authored Jul 1, 2024
2 parents 4c7bfca + 9e27bed commit 31f62b6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public class QOrderEntity extends EntityPathBase<OrderEntity> {

public final org.store.clothstar.member.entity.QMemberEntity member;

public final ListPath<org.store.clothstar.orderDetail.entity.OrderDetailEntity, org.store.clothstar.orderDetail.entity.QOrderDetailEntity> orderDetails = this.<org.store.clothstar.orderDetail.entity.OrderDetailEntity, org.store.clothstar.orderDetail.entity.QOrderDetailEntity>createList("orderDetails", org.store.clothstar.orderDetail.entity.OrderDetailEntity.class, org.store.clothstar.orderDetail.entity.QOrderDetailEntity.class, PathInits.DIRECT2);

public final NumberPath<Long> orderId = createNumber("orderId", Long.class);

public final EnumPath<org.store.clothstar.order.type.PaymentMethod> paymentMethod = createEnum("paymentMethod", org.store.clothstar.order.type.PaymentMethod.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.web.bind.annotation.*;
import org.store.clothstar.common.dto.MessageDTO;
import org.store.clothstar.order.dto.reponse.OrderResponse;
import org.store.clothstar.order.entity.OrderEntity;
import org.store.clothstar.order.service.OrderSellerService;

import java.util.List;
Expand All @@ -21,8 +22,8 @@ public class OrderSellerController {

@Operation(summary = "(판매자) WAITING 주문 리스트 조회", description = "(판매자) 주문상태가 '승인대기'인 주문 리스트를 조회한다.")
@GetMapping
public ResponseEntity<List<OrderResponse>> getWaitingOrder() {
List<OrderResponse> orderResponseList = orderSellerService.getWaitingOrder();
public ResponseEntity<List<OrderEntity>> getWaitingOrder() {
List<OrderEntity> orderResponseList = orderSellerService.getWaitingOrder();
return ResponseEntity.ok(orderResponseList);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.web.server.ResponseStatusException;
import org.store.clothstar.common.dto.MessageDTO;
import org.store.clothstar.order.dto.reponse.OrderResponse;
import org.store.clothstar.order.entity.OrderEntity;
import org.store.clothstar.order.repository.order.OrderRepository;
import org.store.clothstar.order.repository.orderSeller.JpaOrderSellerRepository;
import org.store.clothstar.order.repository.orderSeller.OrderSellerRepository;
Expand Down Expand Up @@ -35,10 +36,9 @@ public OrderSellerService(
}

@Transactional(readOnly = true)
public List<OrderResponse> getWaitingOrder() {
public List<OrderEntity> getWaitingOrder() {

return orderSellerRepository.findWaitingOrders().stream()
.map(OrderResponse::fromOrderEntity)
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@ class OrderSellerServiceTest {
void getWaitingOrder_test() {
//given
OrderEntity order1 = mock(OrderEntity.class);
given(order1.getCreatedAt()).willReturn(LocalDateTime.now());
// given(order1.getCreatedAt()).willReturn(LocalDateTime.now());
given(order1.getTotalShippingPrice()).willReturn(1000);
given(order1.getMember()).willReturn(mockMemberEntity);
given(order1.getAddress()).willReturn(mockAddressEntity);
// given(order1.getMember()).willReturn(mockMemberEntity);
// given(order1.getAddress()).willReturn(mockAddressEntity);

OrderEntity order2 = mock(OrderEntity.class);
given(order2.getCreatedAt()).willReturn(LocalDateTime.now());
given(order2.getMember()).willReturn(mockMemberEntity);
given(order2.getAddress()).willReturn(mockAddressEntity);
// given(order2.getCreatedAt()).willReturn(LocalDateTime.now());
// given(order2.getMember()).willReturn(mockMemberEntity);
// given(order2.getAddress()).willReturn(mockAddressEntity);

OrderEntity order3 = mock(OrderEntity.class);
given(order3.getCreatedAt()).willReturn(LocalDateTime.now());
given(order3.getMember()).willReturn(mockMemberEntity);
given(order3.getAddress()).willReturn(mockAddressEntity);
// given(order3.getCreatedAt()).willReturn(LocalDateTime.now());
// given(order3.getMember()).willReturn(mockMemberEntity);
// given(order3.getAddress()).willReturn(mockAddressEntity);

List<OrderEntity> orders = List.of(order1, order2, order3);
given(orderSellerRepository.findWaitingOrders()).willReturn(orders);

//when
List<OrderResponse> response = orderSellerService.getWaitingOrder();
List<OrderEntity> response = orderSellerService.getWaitingOrder();

//then
then(orderSellerRepository).should(times(1)).findWaitingOrders();
Expand Down

0 comments on commit 31f62b6

Please sign in to comment.