Добавлен основные классы для сервиса авторизаци

This commit is contained in:
Ганеев Артем
2025-10-28 20:49:54 +03:00
parent def3552a67
commit 736b8031f8
26 changed files with 904 additions and 40 deletions

View File

@@ -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
}