chore: build

This commit is contained in:
2026-06-11 12:16:02 +02:00
parent 624f8a0e72
commit 9b50dca96c
3 changed files with 16 additions and 6 deletions
+8 -3
View File
@@ -52,10 +52,15 @@ func (d *Database) CreateProduct(product any) error {
UpdatedAt time.Time `gorm:"column:updated_at"`
}
comingSoonVal := false
if prodModel, ok2 := product.(*models.Product); ok2 {
comingSoonVal = prodModel.ComingSoon
}
err := d.GDB.Raw(`
INSERT INTO products (name, category, description, stock, unit, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id, created_at, updated_at`,
p.GetName(), p.GetCategory(), p.GetDescription(), p.GetStock(), p.GetUnit(), now, now,
INSERT INTO products (name, category, description, stock, unit, coming_soon, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING id, created_at, updated_at`,
p.GetName(), p.GetCategory(), p.GetDescription(), p.GetStock(), p.GetUnit(), comingSoonVal, now, now,
).Scan(&result).Error
if err != nil {
log.Printf("❌ [DB CreateProduct] Erreur INSERT: %v", err)