feat(auth): 重构认证模块,添加登录和检查Token功能,更新路由和数据结构

This commit is contained in:
2025-12-30 18:12:22 +08:00
parent 6d7f4ad1c6
commit 179b6aa0e2
8 changed files with 136 additions and 22 deletions

View File

@@ -23,7 +23,6 @@ type Routes struct {
log *log.Entry `inject:"false"`
middlewares *middlewares.Middlewares
// Controller instances
auth *auth
contents *contents
orders *orders
tenants *tenants
@@ -45,16 +44,6 @@ func (r *Routes) Name() string {
// 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"),
))
// Register routes for controller: contents
r.log.Debugf("Registering route: Get /super/v1/contents -> contents.List")
router.Get("/super/v1/contents"[len(r.Path()):], DataFunc1(