chore: add waf
This commit is contained in:
@@ -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)
|
||||
// ============================================
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user