chore: fix product

This commit is contained in:
2026-02-22 14:36:56 +01:00
parent 2d9bec7392
commit dd10da1536
9 changed files with 38 additions and 20 deletions
+2 -2
View File
@@ -98,7 +98,7 @@ func validateStock(stock float64) error {
return nil
}
func validatePrice(quantity int, price float64) error {
func validatePrice(quantity float64, price float64) error {
if quantity <= 0 {
return fmt.Errorf("quantité doit être > 0")
}
@@ -258,7 +258,7 @@ func CreateProduct(c *gin.Context) {
break
}
quantity, err := strconv.Atoi(quantityStr)
quantity, err := strconv.ParseFloat(quantityStr, 64)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Quantité invalide"})
return