chore: build

This commit is contained in:
2026-06-13 14:23:23 +02:00
parent 6f699bea6a
commit 446b15d29c
13 changed files with 137 additions and 34 deletions
+17
View File
@@ -3,6 +3,7 @@ package handlers
import (
"gestion/db"
"gestion/utils"
"log"
"net/http"
"strings"
@@ -191,10 +192,26 @@ func ClaimMyReward(c *gin.Context) {
return
}
// Ajouter le produit récompense au panier si configuré
productAdded := false
var productName string
if reward.RewardProductID > 0 && reward.RewardQuantity > 0 {
qty := reward.RewardQuantity
if item, addErr := database.AddRewardToBasket(username, reward.RewardProductID, qty); addErr == nil {
productAdded = true
productName = item.ProductName
log.Printf("✅ [CLAIM] Produit récompense id=%d (%.2f) ajouté au panier de %s", reward.RewardProductID, qty, username)
} else {
log.Printf("⚠️ [CLAIM] Impossible d'ajouter produit récompense: %v", addErr)
}
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"description": reward.Description,
"remaining_rewards": remaining,
"product_added": productAdded,
"product_name": productName,
})
}