chore: build

This commit is contained in:
2026-06-11 19:04:04 +02:00
parent a1d5664d6b
commit b5196c5f22
2 changed files with 10 additions and 11 deletions
+4 -4
View File
@@ -182,12 +182,12 @@ func (d *Database) GetProductsByCategory(category string) ([]models.Product, err
return products, nil
}
func (d *Database) UpdateProduct(productID int, name, category, description, unit string, prices []models.ProductPrice) error {
func (d *Database) UpdateProduct(productID int, name, category, description, unit string, comingSoon bool, prices []models.ProductPrice) error {
err := d.GDB.Exec(`
UPDATE products
SET name = ?, category = ?, description = ?, unit = ?, updated_at = ?
SET name = ?, category = ?, description = ?, unit = ?, coming_soon = ?, updated_at = ?
WHERE id = ?`,
name, category, description, unit, time.Now(), productID).Error
name, category, description, unit, comingSoon, time.Now(), productID).Error
if err != nil {
return fmt.Errorf("erreur mise à jour produit: %w", err)
}
@@ -197,7 +197,7 @@ func (d *Database) UpdateProduct(productID int, name, category, description, uni
for _, price := range prices {
if err := d.GDB.Exec(`INSERT INTO product_prices (product_id, quantity, price, active_price) VALUES (?, ?, ?, ?)`,
productID, price.Quantity, price.Price, price.ActivePrice).Error; err != nil {
log.Printf("❌ [UpdateProduct] Erreur prix: %v", err)
return fmt.Errorf("erreur insertion prix: %w", err)
}
}