feat: update multiple tomtom keys and switch tomtom key and add comming soon button

This commit is contained in:
2026-05-19 17:35:39 +02:00
parent 48bdba750e
commit 93120f6bfe
18 changed files with 341 additions and 69 deletions
+10
View File
@@ -278,6 +278,8 @@ func CreateProduct(c *gin.Context) {
log.Printf("✅ [CreateProduct] %s crée produit: %s", username, name)
comingSoon := c.PostForm("coming_soon") == "true"
// ✅ CRÉER LE PRODUIT
product := models.Product{
Name: name,
@@ -285,6 +287,7 @@ func CreateProduct(c *gin.Context) {
Description: description,
Stock: stock,
Unit: unit,
ComingSoon: comingSoon,
Prices: prices,
}
@@ -573,6 +576,7 @@ func UpdateProduct(c *gin.Context) {
Unit string `json:"unit"`
Prices []models.ProductPrice `json:"prices"`
Stock *float64 `json:"stock"`
ComingSoon *bool `json:"coming_soon"`
}
if err := c.ShouldBindJSON(&updateData); err != nil {
@@ -638,6 +642,12 @@ func UpdateProduct(c *gin.Context) {
}
}
if updateData.ComingSoon != nil {
if err := database.SetProductComingSoon(id, *updateData.ComingSoon); err != nil {
log.Printf("⚠️ [UpdateProduct] Erreur mise à jour coming_soon: %v", err)
}
}
// ✅ RÉCUPÉRER LE PRODUIT MIS À JOUR
updatedProduct, _ := database.GetProductByID(id)
media, _ := database.GetMediaByProductID(id)