add notes

This commit is contained in:
aditya.siregar
2025-05-16 13:18:11 +07:00
parent dea7d4c2b3
commit 2b1c49ad63
7 changed files with 18 additions and 2 deletions
+4 -2
View File
@@ -58,8 +58,9 @@ func (o *InquiryRequest) GetPaymentProvider() string {
}
type OrderItemRequest struct {
ProductID int64 `json:"product_id" validate:"required"`
Quantity int `json:"quantity" validate:"required,min=1"`
ProductID int64 `json:"product_id" validate:"required"`
Quantity int `json:"quantity" validate:"required,min=1"`
Notes string `json:"notes"`
}
type ExecuteRequest struct {
@@ -91,6 +92,7 @@ func (h *Handler) Inquiry(c *gin.Context) {
orderItems[i] = entity.OrderItemRequest{
ProductID: item.ProductID,
Quantity: item.Quantity,
Notes: item.Notes,
}
}
+2
View File
@@ -95,6 +95,7 @@ type OrderItem struct {
ProductID int64 `json:"product_id" validate:"required"`
Quantity int `json:"quantity" validate:"required"`
Description string `json:"description"`
Notes string `json:"notes"`
}
func (o *Order) ToEntity(partnerID, createdBy int64) *entity.OrderRequest {
@@ -162,6 +163,7 @@ func (o *OrderCustomer) ToEntity(partnerID, createdBy int64) *entity.OrderReques
ProductID: item.ProductID,
Quantity: item.Quantity,
Description: item.Description,
Notes: item.Notes,
}
}
@@ -28,6 +28,7 @@ type OrderItemResponse struct {
Price float64 `json:"price"`
Quantity int `json:"quantity"`
Subtotal float64 `json:"subtotal"`
Notes string `json:"notes"`
}
func mapToOrderItemResponses(items []entity.OrderItem) []OrderItemResponse {
@@ -113,6 +114,7 @@ func MapToOrderItemResponses(items []entity.OrderItem) []OrderItemResponse {
Price: item.Price,
Quantity: item.Quantity,
Subtotal: item.Price * float64(item.Quantity),
Notes: item.Notes,
})
}
return result