Add order items

This commit is contained in:
Aditya Siregar
2025-08-08 22:33:08 +07:00
parent c18e915d1e
commit 8e9c14b860
14 changed files with 427 additions and 200 deletions
+4 -4
View File
@@ -449,17 +449,17 @@ func (s *OrderServiceImpl) validateSplitBillRequest(req *models.SplitBillRequest
return fmt.Errorf("items are required when splitting by ITEM")
}
totalItemAmount := float64(0)
totalItemAmount := 0
for i, item := range req.Items {
if item.OrderItemID == uuid.Nil {
return fmt.Errorf("order item ID is required for item %d", i+1)
}
if item.Amount <= 0 {
return fmt.Errorf("amount must be greater than zero for item %d", i+1)
if item.Quantity <= 0 {
return fmt.Errorf("quantity must be greater than zero for item %d", i+1)
}
totalItemAmount += item.Amount
totalItemAmount += item.Quantity
}
if totalItemAmount <= 0 {