chore: refacto
This commit is contained in:
@@ -32,7 +32,7 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
|
||||
// ============================================
|
||||
authGroupV1 := router.Group("/api/v1/auth")
|
||||
{
|
||||
authGroupV1.POST("/login", handlers.LoginClient)
|
||||
authGroupV1.POST("/login", middleware.LoginRateLimitMiddleware, handlers.LoginClient)
|
||||
authGroupV1.POST("/logout", handlers.LogoutClient)
|
||||
}
|
||||
|
||||
@@ -61,21 +61,22 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
|
||||
cartGroupV1 := router.Group("/api/v1")
|
||||
cartGroupV1.Use(middleware.ClientMiddleware)
|
||||
cartGroupV1.Use(middleware.ClientSessionMiddleware)
|
||||
cartGroupV1.Use(middleware.RateLimitMiddleware)
|
||||
{
|
||||
// Panier
|
||||
cartGroupV1.POST("/panier/add", handlers.AddProductsBasket)
|
||||
cartGroupV1.GET("/panier/:username", handlers.GetAllBaskets)
|
||||
cartGroupV1.DELETE("/panier/remove", handlers.DeleteProductFromBasket)
|
||||
cartGroupV1.DELETE("/panier/clear", handlers.ClearBasket) // ✅ CORRIGÉ - Sans :username
|
||||
cartGroupV1.DELETE("/panier/clear", handlers.ClearBasket)
|
||||
|
||||
// Commandes
|
||||
cartGroupV1.POST("/checkout", middleware.OrderHoursMiddleware, middleware.BlockClientIfPenalty, handlers.ValidateBasket) // ✅ Auto-assign GPS
|
||||
cartGroupV1.GET("/my-commands", handlers.GetMyCommandsWithTracking) // ✅ Avec suivi
|
||||
|
||||
// ⭐ NOUVEAUX - SUIVI CLIENT TEMPS RÉEL
|
||||
cartGroupV1.GET("/commands/:id/eta", handlers.GetOrderETA) // ✅ AJOUTÉ
|
||||
cartGroupV1.GET("/commands/:id/status", handlers.GetCommandStatus) // ✅ AJOUTÉ
|
||||
cartGroupV1.GET("/commands/:id/tracking", handlers.GetCommandTracking) // ✅ AJOUTÉ
|
||||
cartGroupV1.GET("/commands/:id/eta", handlers.GetOrderETA)
|
||||
cartGroupV1.GET("/commands/:id/status", handlers.GetCommandStatus)
|
||||
cartGroupV1.GET("/commands/:id/tracking", handlers.GetCommandTracking)
|
||||
cartGroupV1.GET("/commands/:id", handlers.GetCommandByID)
|
||||
cartGroupV1.GET("/commands/:id/items", handlers.GetCommandItemsWithDetails)
|
||||
// Approbation livraison
|
||||
@@ -103,8 +104,8 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
|
||||
cartGroupV1.DELETE("/telegram/unlink", handlers.UnlinkClientTelegram)
|
||||
|
||||
// 👤 PROFIL CLIENT
|
||||
cartGroupV1.GET("/profile", handlers.GetMyProfile) // ✅ Récupérer mon profil
|
||||
cartGroupV1.PUT("/profile/update", handlers.UpdateMyProfile) // ✅ Modifier mon profil
|
||||
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)
|
||||
@@ -123,15 +124,6 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
|
||||
// ============================================
|
||||
router.POST("/webhook/telegram", handlers.TelegramWebhook)
|
||||
|
||||
// ============================================
|
||||
// 🌍 GÉOCODAGE PUBLIC (v1)
|
||||
// ============================================
|
||||
geoGroupV1 := router.Group("/api/v1")
|
||||
{
|
||||
geoGroupV1.POST("/geocode", handlers.GeocodeAddress)
|
||||
geoGroupV1.POST("/validate-address", handlers.ValidateAddress)
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// 📋 PATTERN v2: ADMIN API
|
||||
// ============================================
|
||||
@@ -141,8 +133,8 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
|
||||
// ============================================
|
||||
adminAuthGroupV2 := router.Group("/api/v2/admin/auth")
|
||||
{
|
||||
adminAuthGroupV2.POST("/register", handlers.RegisterAdmin)
|
||||
adminAuthGroupV2.POST("/login", handlers.LoginAdmin)
|
||||
//adminAuthGroupV2.POST("/register", handlers.RegisterAdmin)
|
||||
adminAuthGroupV2.POST("/login", middleware.LoginRateLimitMiddleware, handlers.LoginAdmin)
|
||||
adminAuthGroupV2.POST("/logout", handlers.LogoutAdmin)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user