-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.go
19 lines (17 loc) · 835 Bytes
/
routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package http
import (
"github.com/iamaul/go-pokedex/config"
"github.com/iamaul/go-pokedex/internal/auth"
"github.com/iamaul/go-pokedex/internal/middleware"
"github.com/labstack/echo/v4"
)
func AuthRoutes(authGroup *echo.Group, h auth.DeliveryHandlers, au auth.Usecase, cfg *config.Config, mw *middleware.MiddlewareManager) {
authGroup.POST("/new", h.Register())
authGroup.POST("", h.Login())
authGroup.PUT("", h.UpdateUser(), mw.AuthJWTMiddleware(au, cfg))
authGroup.DELETE("/:id", h.DeleteUser(), mw.AuthJWTMiddleware(au, cfg), mw.RoleBasedAuthMiddleware([]string{"admin"}))
authGroup.GET("/user/list", h.ListUser())
authGroup.GET("/:id", h.DetailUser(), mw.AuthJWTMiddleware(au, cfg))
authGroup.POST("/:id", h.CatchMonster(), mw.AuthJWTMiddleware(au, cfg))
authGroup.GET("/me", h.Me(), mw.AuthJWTMiddleware(au, cfg))
}