chore: update
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/omnex/control-plane/api/internal/config"
|
||||
"github.com/omnex/control-plane/api/internal/demos"
|
||||
"github.com/omnex/control-plane/api/internal/httpx"
|
||||
"github.com/omnex/control-plane/api/internal/leads"
|
||||
"github.com/omnex/control-plane/api/internal/profile"
|
||||
"github.com/omnex/control-plane/api/internal/session"
|
||||
"github.com/omnex/control-plane/api/internal/sub"
|
||||
@@ -22,7 +21,6 @@ type Deps struct {
|
||||
Issuer *auth.Issuer
|
||||
Sessions session.Manager
|
||||
AuthH *auth.Handler
|
||||
LeadsH *leads.Handler
|
||||
DemosH *demos.Handler
|
||||
SubH *sub.Handler
|
||||
ProfileH *profile.Handler
|
||||
@@ -42,10 +40,9 @@ func New(d Deps) *gin.Engine {
|
||||
|
||||
api := r.Group("/api/v1")
|
||||
|
||||
// Public : login, inscription + formulaire de contact, rate-limités.
|
||||
// Public : login, inscription, rate-limités.
|
||||
api.POST("/auth/login", httpx.RateLimit(1, 5), d.AuthH.Login)
|
||||
api.POST("/auth/register", httpx.RateLimit(0.2, 3), d.AuthH.Register)
|
||||
api.POST("/leads", httpx.RateLimit(1, 3), d.LeadsH.Create)
|
||||
// Toute route authentifiée (session valide, n'importe quel rôle).
|
||||
authed := api.Group("")
|
||||
authed.Use(auth.RequireAuth(d.Issuer, d.Sessions))
|
||||
@@ -60,8 +57,6 @@ func New(d Deps) *gin.Engine {
|
||||
client := authed.Group("")
|
||||
client.Use(auth.RequireRole(auth.RoleClient))
|
||||
{
|
||||
client.GET("/leads", d.LeadsH.List)
|
||||
client.PATCH("/leads/:id/status", d.LeadsH.SetStatus)
|
||||
client.POST("/subscription", d.SubH.AddCode)
|
||||
if d.DemosH != nil {
|
||||
client.GET("/demos/mine", d.DemosH.ListMine)
|
||||
|
||||
Reference in New Issue
Block a user