chore: fix

This commit is contained in:
2026-05-15 18:10:23 +02:00
parent f951ed9187
commit 7443d06029
+13 -4
View File
@@ -456,7 +456,10 @@ func GetAllProducts(c *gin.Context) {
})
return
}
role := c.GetString("role")
if role != "admin" && role != "cabine" {
products = filterActivePrices(products)
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"data": products,
@@ -493,11 +496,14 @@ func GetProductsByCategory(c *gin.Context) {
media, _ := database.GetMediaByProductID(products[i].ID)
products[i].Media = media
}
filteredProducts := filterActivePrices(products)
roleCtx := c.GetString("role")
if roleCtx != "admin" && roleCtx != "cabine" {
products = filterActivePrices(products)
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"data": filteredProducts,
"count": len(filteredProducts),
"data": products,
"count": len(products),
})
}
@@ -523,8 +529,11 @@ func GetProductByID(c *gin.Context) {
media, _ := database.GetMediaByProductID(product.ID)
product.Media = media
// ✅ Filtrer les prix désactivés
// ✅ Filtrer les prix désactivés (sauf pour admin/cabine)
role := c.GetString("role")
if role != "admin" && role != "cabine" {
filterActivepricesSingle(&product)
}
c.JSON(http.StatusOK, gin.H{
"success": true,