Добавлен основные классы для сервиса авторизаци
This commit is contained in:
@@ -1,17 +1,40 @@
|
||||
package handler
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
import (
|
||||
"authorization/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
services *service.Service
|
||||
}
|
||||
|
||||
func NewHandler(services *service.Service) *Handler {
|
||||
return &Handler{
|
||||
services: services,
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handler) InitRoutes() *gin.Engine {
|
||||
router := gin.New()
|
||||
|
||||
auth := router.Group("/auth")
|
||||
serviceRouter := router.Group("/auth-service")
|
||||
{
|
||||
auth.POST("/sign-up", h.signUp)
|
||||
auth.POST("/sign-in", h.signIn)
|
||||
auth := serviceRouter.Group("/auth")
|
||||
{
|
||||
auth.POST("/sign-up", h.signUp)
|
||||
auth.POST("/sign-in", h.signIn)
|
||||
auth.POST("/refresh", h.refresh)
|
||||
}
|
||||
api := router.Group("/api")
|
||||
{
|
||||
users := api.Group("/users", h.checkAdminIdentity)
|
||||
{
|
||||
users.POST("/:username", h.changeUserRole)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return router
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user