-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NAYB-159] feat: 점원과 라이더는 배달 상세를 조회할 수 있다.
[NAYB-159] feat: 점원과 라이더는 배달 상세를 조회할 수 있다.
- Loading branch information
Showing
12 changed files
with
261 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/com/prgrms/nabmart/domain/delivery/controller/FindDeliveryDetailResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.prgrms.nabmart.domain.delivery.controller; | ||
|
||
import com.prgrms.nabmart.domain.delivery.Delivery; | ||
import com.prgrms.nabmart.domain.delivery.DeliveryStatus; | ||
import com.prgrms.nabmart.domain.order.OrderItem; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
public record FindDeliveryDetailResponse( | ||
Long deliveryId, | ||
DeliveryStatus deliveryStatus, | ||
LocalDateTime arrivedAt, | ||
String address, | ||
String orderName, | ||
int orderPrice, | ||
String riderRequest, | ||
int deliveryFee, | ||
List<OrderItemResponse> items) { | ||
|
||
|
||
public static FindDeliveryDetailResponse from(final Delivery delivery) { | ||
List<OrderItemResponse> items = delivery.getOrder().getOrderItems().stream() | ||
.map(OrderItemResponse::from) | ||
.toList(); | ||
return new FindDeliveryDetailResponse( | ||
delivery.getDeliveryId(), | ||
delivery.getDeliveryStatus(), | ||
delivery.getArrivedAt(), | ||
delivery.getAddress(), | ||
delivery.getOrder().getName(), | ||
delivery.getOrderPrice(), | ||
delivery.getRiderRequest(), | ||
delivery.getDeliveryFee(), | ||
items); | ||
} | ||
|
||
public record OrderItemResponse(String name, int quantity, int price) { | ||
|
||
public static OrderItemResponse from(final OrderItem orderItem) { | ||
return new OrderItemResponse( | ||
orderItem.getItem().getName(), | ||
orderItem.getQuantity(), | ||
orderItem.getItem().getPrice()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...n/java/com/prgrms/nabmart/domain/delivery/service/request/FindDeliveryByOrderCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.prgrms.nabmart.domain.delivery.service.request; | ||
|
||
public record FindDeliveryByOrderCommand(Long userId, Long orderId) { | ||
|
||
public static FindDeliveryByOrderCommand of(final Long userId,final Long orderId) { | ||
return new FindDeliveryByOrderCommand(userId, orderId); | ||
} | ||
} |
8 changes: 0 additions & 8 deletions
8
src/main/java/com/prgrms/nabmart/domain/delivery/service/request/FindDeliveryCommand.java
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...in/java/com/prgrms/nabmart/domain/delivery/service/request/FindDeliveryDetailCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.prgrms.nabmart.domain.delivery.service.request; | ||
|
||
public record FindDeliveryDetailCommand(Long deliveryId) { | ||
|
||
public static FindDeliveryDetailCommand from(final Long deliveryId) { | ||
return new FindDeliveryDetailCommand(deliveryId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.