update order

This commit is contained in:
aditya.siregar
2025-05-06 00:40:43 +07:00
parent f98200f76b
commit 93ddfdaecc
5 changed files with 31 additions and 15 deletions
+2
View File
@@ -190,6 +190,8 @@ type OrderDetailItem struct {
type OrderHistoryResponse struct {
ID int64 `json:"id"`
IsMember bool `json:"is_member"`
CustomerID *int64 `json:"customer_id"`
CustomerName string `json:"customer_name"`
Status string `json:"status"`
Amount float64 `json:"amount"`
+1 -6
View File
@@ -102,14 +102,9 @@ func MapToOrderResponse(result *entity.OrderResponse) OrderResponse {
func MapToOrderItemResponses(items []entity.OrderItem) []OrderItemResponse {
result := make([]OrderItemResponse, 0, len(items))
for _, item := range items {
productName := ""
if item.Product != nil {
productName = item.Product.Name
}
result = append(result, OrderItemResponse{
ProductID: item.ItemID,
ProductName: productName,
ProductName: item.ItemName,
Price: item.Price,
Quantity: item.Quantity,
Subtotal: item.Price * float64(item.Quantity),