chore: refacto

This commit is contained in:
2026-04-20 19:41:52 +02:00
parent 5fc52c72ee
commit 2e9827af98
46 changed files with 497 additions and 648 deletions
+4 -4
View File
@@ -2,6 +2,7 @@ package handlers
import (
"gestion/db"
"gestion/utils"
"log"
"net/http"
@@ -26,7 +27,7 @@ func GetMyReferralBalance(c *gin.Context) {
balance, err := database.GetClientReferralBalance(username.(string))
if err != nil {
c.JSON(http.StatusNotFound, gin.H{"error": err.Error()})
c.JSON(http.StatusNotFound, gin.H{"error": "Solde de parrainage introuvable"})
return
}
@@ -47,8 +48,7 @@ func CreditClientReferralAdmin(c *gin.Context) {
}
if err := database.CreditClientReferral(targetUsername, req.Amount); err != nil {
log.Printf("❌ [REFERRAL] Crédit échoué pour %s: %v", targetUsername, err)
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
utils.ServerErr(c, "Impossible de créditer le solde", err)
return
}
@@ -68,7 +68,7 @@ func GetClientReferralAdmin(c *gin.Context) {
balance, err := database.GetClientReferralBalance(targetUsername)
if err != nil {
c.JSON(http.StatusNotFound, gin.H{"error": err.Error()})
c.JSON(http.StatusNotFound, gin.H{"error": "Client introuvable"})
return
}