chore: fix product
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user