Add order items
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user