87 lines
2.8 KiB
Go
87 lines
2.8 KiB
Go
// Code generated by atomctl. DO NOT EDIT.
|
|
|
|
// Package web provides HTTP route definitions and registration
|
|
// for the quyun/v2 application.
|
|
package web
|
|
|
|
import (
|
|
"quyun/v2/app/http/web/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 web module.
|
|
//
|
|
// @provider contracts.HttpRoute atom.GroupRoutes
|
|
type Routes struct {
|
|
log *log.Entry `inject:"false"`
|
|
middlewares *middlewares.Middlewares
|
|
// Controller instances
|
|
auth *auth
|
|
me *me
|
|
}
|
|
|
|
// Prepare initializes the routes provider with logging configuration.
|
|
func (r *Routes) Prepare() error {
|
|
r.log = log.WithField("module", "routes.web")
|
|
r.log.Info("Initializing routes module")
|
|
return nil
|
|
}
|
|
|
|
// Name returns the unique identifier for this routes provider.
|
|
func (r *Routes) Name() string {
|
|
return "web"
|
|
}
|
|
|
|
// 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 /v1/auth/token -> auth.token")
|
|
router.Get("/v1/auth/token"[len(r.Path()):], DataFunc0(
|
|
r.auth.token,
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/auth/login -> auth.login")
|
|
router.Post("/v1/auth/login"[len(r.Path()):], DataFunc1(
|
|
r.auth.login,
|
|
Body[dto.LoginForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/auth/password/reset -> auth.passwordReset")
|
|
router.Post("/v1/auth/password/reset"[len(r.Path()):], DataFunc1(
|
|
r.auth.passwordReset,
|
|
Body[dto.PasswordResetForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/auth/password/reset/sms -> auth.passwordResetSendSMS")
|
|
router.Post("/v1/auth/password/reset/sms"[len(r.Path()):], DataFunc1(
|
|
r.auth.passwordResetSendSMS,
|
|
Body[dto.PasswordResetSendSMSForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/auth/password/reset/verify -> auth.passwordResetVerify")
|
|
router.Post("/v1/auth/password/reset/verify"[len(r.Path()):], DataFunc1(
|
|
r.auth.passwordResetVerify,
|
|
Body[dto.PasswordResetVerifyForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/auth/register -> auth.register")
|
|
router.Post("/v1/auth/register"[len(r.Path()):], DataFunc1(
|
|
r.auth.register,
|
|
Body[dto.RegisterForm]("form"),
|
|
))
|
|
// Register routes for controller: me
|
|
r.log.Debugf("Registering route: Get /v1/me -> me.me")
|
|
router.Get("/v1/me"[len(r.Path()):], DataFunc0(
|
|
r.me.me,
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/me/tenants -> me.myTenants")
|
|
router.Get("/v1/me/tenants"[len(r.Path()):], DataFunc0(
|
|
r.me.myTenants,
|
|
))
|
|
|
|
r.log.Info("Successfully registered all routes")
|
|
}
|