[feature/backend] implement /auth/logout handling + overall enhancement
This commit is contained in:
parent
d8d8e4b0d7
commit
e5fc8691bf
12 changed files with 420 additions and 64 deletions
|
@ -14,14 +14,12 @@ import (
|
|||
|
||||
type Handler struct {
|
||||
cfg *config.Config
|
||||
config *config.Config
|
||||
service service.Service
|
||||
}
|
||||
|
||||
func NewHandler(cfg *config.Config, service service.Service) *Handler {
|
||||
return &Handler{
|
||||
cfg: cfg,
|
||||
config: cfg,
|
||||
service: service,
|
||||
}
|
||||
}
|
||||
|
@ -35,10 +33,11 @@ func (h *Handler) RegisterRoutes(r *gin.Engine) {
|
|||
{
|
||||
auth.POST("/register", h.Register)
|
||||
auth.POST("/login", h.Login)
|
||||
auth.POST("/logout", middleware.AuthMiddleware(h.cfg.JWT.Secret, h.service.GetTokenBlacklist()), h.Logout)
|
||||
}
|
||||
|
||||
// User routes
|
||||
users := api.Group("/users", middleware.AuthMiddleware(h.config.JWT.Secret))
|
||||
users := api.Group("/users", middleware.AuthMiddleware(h.cfg.JWT.Secret, h.service.GetTokenBlacklist()))
|
||||
{
|
||||
users.GET("", h.ListUsers)
|
||||
users.POST("", h.CreateUser)
|
||||
|
@ -86,7 +85,7 @@ func (h *Handler) RegisterRoutes(r *gin.Engine) {
|
|||
}
|
||||
|
||||
// Media routes
|
||||
media := api.Group("/media")
|
||||
media := api.Group("/media", middleware.AuthMiddleware(h.cfg.JWT.Secret, h.service.GetTokenBlacklist()))
|
||||
{
|
||||
media.GET("", h.ListMedia)
|
||||
media.POST("", h.UploadMedia)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue