feat(auth): 重构认证模块,添加登录和检查Token功能,更新路由和数据结构
This commit is contained in:
56
backend/app/http/super/v1/auth/routes.gen.go
Normal file
56
backend/app/http/super/v1/auth/routes.gen.go
Normal file
@@ -0,0 +1,56 @@
|
||||
// Code generated by atomctl. DO NOT EDIT.
|
||||
|
||||
// Package auth provides HTTP route definitions and registration
|
||||
// for the quyun/v2 application.
|
||||
package auth
|
||||
|
||||
import (
|
||||
dto "quyun/v2/app/http/super/v1/dto"
|
||||
"quyun/v2/app/middlewares"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
log "github.com/sirupsen/logrus"
|
||||
_ "go.ipao.vip/atom"
|
||||
_ "go.ipao.vip/atom/contracts"
|
||||
. "go.ipao.vip/atom/fen"
|
||||
)
|
||||
|
||||
// Routes implements the HttpRoute contract and provides route registration
|
||||
// for all controllers in the auth module.
|
||||
//
|
||||
// @provider contracts.HttpRoute atom.GroupRoutes
|
||||
type Routes struct {
|
||||
log *log.Entry `inject:"false"`
|
||||
middlewares *middlewares.Middlewares
|
||||
// Controller instances
|
||||
auth *auth
|
||||
}
|
||||
|
||||
// Prepare initializes the routes provider with logging configuration.
|
||||
func (r *Routes) Prepare() error {
|
||||
r.log = log.WithField("module", "routes.auth")
|
||||
r.log.Info("Initializing routes module")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Name returns the unique identifier for this routes provider.
|
||||
func (r *Routes) Name() string {
|
||||
return "auth"
|
||||
}
|
||||
|
||||
// Register registers all HTTP routes with the provided fiber router.
|
||||
// Each route is registered with its corresponding controller action and parameter bindings.
|
||||
func (r *Routes) Register(router fiber.Router) {
|
||||
// Register routes for controller: auth
|
||||
r.log.Debugf("Registering route: Get /super/v1/auth/token -> auth.CheckToken")
|
||||
router.Get("/super/v1/auth/token"[len(r.Path()):], DataFunc0(
|
||||
r.auth.CheckToken,
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /super/v1/auth/login -> auth.Login")
|
||||
router.Post("/super/v1/auth/login"[len(r.Path()):], DataFunc1(
|
||||
r.auth.Login,
|
||||
Body[dto.LoginForm]("form"),
|
||||
))
|
||||
|
||||
r.log.Info("Successfully registered all routes")
|
||||
}
|
||||
Reference in New Issue
Block a user