chore: add waf

This commit is contained in:
2026-03-15 13:31:48 +01:00
parent 2e7340f9a6
commit 42276ca4ff
18 changed files with 164 additions and 3508 deletions
@@ -139,6 +139,23 @@ func UpdateMyProfile(c *gin.Context) {
})
}
// GetMyProfile retourne le profil du client connecté
// GET /api/v1/profile
func GetMyProfile(c *gin.Context) {
database := c.MustGet("database").(*db.Database)
username, exists := c.Get("username")
if !exists {
c.JSON(http.StatusUnauthorized, gin.H{"error": "Non authentifié"})
return
}
client, err := database.GetClientByUsername(username.(string))
if err != nil || client == nil {
c.JSON(http.StatusNotFound, gin.H{"error": "Client non trouvé"})
return
}
c.JSON(http.StatusOK, gin.H{"success": true, "client": sanitizeClient(client)})
}
// ============================================
// MODIFICATION PROFIL CLIENT (PAR ADMIN)
// ============================================
+3 -2
View File
@@ -101,8 +101,9 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
cartGroupV1.POST("/push-token", handlers.RegisterPushToken)
cartGroupV1.DELETE("/push-token", handlers.UnregisterPushToken)
// 👤 PROFIL CLIENT - MODIFICATION PAR LE CLIENT
cartGroupV1.PUT("/profile/update", handlers.UpdateMyProfile) // ✅ Modifier mon profil
// 👤 PROFIL CLIENT
cartGroupV1.GET("/profile", handlers.GetMyProfile) // ✅ Récupérer mon profil
cartGroupV1.PUT("/profile/update", handlers.UpdateMyProfile) // ✅ Modifier mon profil
// 🎁 PARRAINAGE CLIENT
cartGroupV1.GET("/referral/balance", handlers.GetMyReferralBalance)