@@ -52,28 +52,24 @@ func New(d Deps) *gin.Engine {
|
|||||||
{
|
{
|
||||||
authed.POST("/auth/logout", d.AuthH.Logout)
|
authed.POST("/auth/logout", d.AuthH.Logout)
|
||||||
authed.GET("/auth/me", d.AuthH.Me)
|
authed.GET("/auth/me", d.AuthH.Me)
|
||||||
|
authed.POST("/profile/username", d.ProfileH.UpdateUsernameById)
|
||||||
|
authed.POST("/profile/password", d.ProfileH.UpdatePasswordById)
|
||||||
|
authed.GET("/profile/telegram", d.ProfileH.GetTelegramById)
|
||||||
|
authed.POST("/profile/telegram", d.ProfileH.SetTelegramById)
|
||||||
}
|
}
|
||||||
|
|
||||||
client := authed.Group("")
|
client := authed.Group("")
|
||||||
client.Use(auth.RequireRole(auth.RoleClient))
|
client.Use(auth.RequireRole(auth.RoleClient))
|
||||||
{
|
{
|
||||||
client.GET("/leads", d.LeadsH.List)
|
client.GET("/leads", d.LeadsH.List)
|
||||||
client.PATCH("/leads/:id/status", d.LeadsH.SetStatus)
|
client.PATCH("/leads/:id/status", d.LeadsH.SetStatus)
|
||||||
client.POST("/subscription", d.SubH.AddCode)
|
client.POST("/subscription", d.SubH.AddCode)
|
||||||
client.POST("/profile/username", d.ProfileH.UpdateUsernameById)
|
|
||||||
client.POST("/profile/password", d.ProfileH.UpdatePasswordById)
|
|
||||||
client.GET("/profile/telegram", d.ProfileH.GetTelegramById)
|
|
||||||
client.POST("/profile/telegram", d.ProfileH.SetTelegramById)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Espace admin : provisioning des démos (admin uniquement).
|
// Espace admin : provisioning des démos (admin uniquement).
|
||||||
admin := authed.Group("")
|
admin := authed.Group("")
|
||||||
admin.Use(auth.RequireRole(auth.RoleAdmin))
|
admin.Use(auth.RequireRole(auth.RoleAdmin))
|
||||||
{
|
{
|
||||||
admin.GET("/codes", d.SubH.ListCodes)
|
admin.GET("/codes", d.SubH.ListCodes)
|
||||||
admin.POST("/codes", d.SubH.CreateCodeForBuy)
|
admin.POST("/codes", d.SubH.CreateCodeForBuy)
|
||||||
admin.POST("/profile/username", d.ProfileH.UpdateUsernameById)
|
|
||||||
admin.POST("/profile/password", d.ProfileH.UpdatePasswordById)
|
|
||||||
if d.DemosH != nil {
|
if d.DemosH != nil {
|
||||||
admin.POST("/demos", d.DemosH.Create)
|
admin.POST("/demos", d.DemosH.Create)
|
||||||
admin.GET("/demos", d.DemosH.List)
|
admin.GET("/demos", d.DemosH.List)
|
||||||
|
|||||||
Reference in New Issue
Block a user