chore: refacto

This commit is contained in:
2026-03-27 22:23:46 +01:00
parent 75bf4caaa1
commit 5380abe8ed
67 changed files with 1751 additions and 2573 deletions
+23 -13
View File
@@ -97,9 +97,10 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
cartGroupV1.GET("/notifications", handlers.GetClientNotifications)
cartGroupV1.POST("/notifications/read", handlers.MarkNotificationsRead)
// 📱 PUSH TOKEN
cartGroupV1.POST("/push-token", handlers.RegisterPushToken)
cartGroupV1.DELETE("/push-token", handlers.UnregisterPushToken)
// 🤖 TELEGRAM CLIENT
cartGroupV1.POST("/telegram/link-token", handlers.GenerateClientLinkToken)
cartGroupV1.GET("/telegram/status", handlers.GetClientTelegramStatus)
cartGroupV1.DELETE("/telegram/unlink", handlers.UnlinkClientTelegram)
// 👤 PROFIL CLIENT
cartGroupV1.GET("/profile", handlers.GetMyProfile) // ✅ Récupérer mon profil
@@ -117,6 +118,11 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
// ============================================
router.POST("/api/v1/webhooks/nowpayments", handlers.IPNWebhook)
// ============================================
// 🤖 WEBHOOK TELEGRAM - PUBLIC (sécurisé par secret header)
// ============================================
router.POST("/webhook/telegram", handlers.TelegramWebhook)
// ============================================
// 🌍 GÉOCODAGE PUBLIC (v1)
// ============================================
@@ -146,14 +152,14 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
adminGroupV2 := router.Group("/api/v2/admin/protected")
adminGroupV2.Use(middleware.AdminMiddleware)
{
// PUSH TOKEN ADMIN
adminGroupV2.POST("/push-token", handlers.RegisterAdminPushToken)
adminGroupV2.DELETE("/push-token", handlers.UnregisterAdminPushToken)
// 🔔 NOTIFICATIONS ADMIN
adminGroupV2.GET("/notifications", handlers.GetLivreurNotifications)
adminGroupV2.POST("/notifications/read", handlers.MarkLivreurNotificationsRead)
// 🤖 TELEGRAM ADMIN
adminGroupV2.POST("/telegram/link-token", handlers.GenerateAdminLinkToken)
adminGroupV2.DELETE("/telegram/unlink", handlers.UnlinkAdminTelegram)
// ============================================
// CLIENT - GESTION
// ============================================
@@ -285,14 +291,14 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
cabineGroupV1.POST("/add/address", handlers.AddAddress)
cabineGroupV1.DELETE("/delete/address", handlers.DeleteAddress)
cabineGroupV1.GET("/addresses", handlers.GetAllAddress)
// PUSH TOKEN CABINE
cabineGroupV1.POST("/push-token", handlers.RegisterCabinePushToken)
cabineGroupV1.DELETE("/push-token", handlers.UnregisterCabinePushToken)
// 🔔 NOTIFICATIONS CABINE
cabineGroupV1.GET("/notifications", handlers.GetLivreurNotifications)
cabineGroupV1.POST("/notifications/read", handlers.MarkLivreurNotificationsRead)
// 🤖 TELEGRAM CABINE
cabineGroupV1.POST("/telegram/link-token", handlers.GenerateAdminLinkToken)
cabineGroupV1.DELETE("/telegram/unlink", handlers.UnlinkAdminTelegram)
cabineGroupV1.GET("/commands/:id/items", handlers.ShowItems)
cabineGroupV1.POST("/commands/:id/confirm-reception", handlers.StaffApproveDelivery)
cabineGroupV1.POST("/commands/:id/assign", handlers.AssignDeliveryPerson)
@@ -331,6 +337,7 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
livreurGroupV1.GET("/deliveries/:id", handlers.GetDeliveryDetails) // ✅ Détail filtré
livreurGroupV1.POST("/deliveries/:id/start", handlers.StartDelivery)
livreurGroupV1.PUT("/deliveries/:id/status", handlers.UpdateDeliveryStatus) // ✅ Avec GPS
livreurGroupV1.GET("/deliveries/:id/nav-link", handlers.GetLivreurNavLink) // Lien Waze App
// ============================================
// POSITION GPS
@@ -362,7 +369,10 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
// ============================================
livreurGroupV1.GET("/notifications", handlers.GetLivreurNotifications)
livreurGroupV1.POST("/notifications/read", handlers.MarkLivreurNotificationsRead)
livreurGroupV1.POST("/push-token", handlers.RegisterLivreurPushToken)
livreurGroupV1.DELETE("/push-token", handlers.UnregisterLivreurPushToken)
// 🤖 TELEGRAM LIVREUR
livreurGroupV1.POST("/telegram/link-token", handlers.GenerateLivreurLinkToken)
livreurGroupV1.GET("/telegram/status", handlers.GetLivreurTelegramStatus)
livreurGroupV1.DELETE("/telegram/unlink", handlers.UnlinkLivreurTelegram)
}
}