55 lines
1.5 KiB
Go
55 lines
1.5 KiB
Go
// Code generated by atomctl. DO NOT EDIT.
|
|
|
|
// Package tenant provides HTTP route definitions and registration
|
|
// for the quyun/v2 application.
|
|
package tenant
|
|
|
|
import (
|
|
"quyun/v2/app/middlewares"
|
|
"quyun/v2/database/models"
|
|
|
|
"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 tenant module.
|
|
//
|
|
// @provider contracts.HttpRoute atom.GroupRoutes
|
|
type Routes struct {
|
|
log *log.Entry `inject:"false"`
|
|
middlewares *middlewares.Middlewares
|
|
// Controller instances
|
|
me *me
|
|
}
|
|
|
|
// Prepare initializes the routes provider with logging configuration.
|
|
func (r *Routes) Prepare() error {
|
|
r.log = log.WithField("module", "routes.tenant")
|
|
r.log.Info("Initializing routes module")
|
|
return nil
|
|
}
|
|
|
|
// Name returns the unique identifier for this routes provider.
|
|
func (r *Routes) Name() string {
|
|
return "tenant"
|
|
}
|
|
|
|
// 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: me
|
|
r.log.Debugf("Registering route: Get /t/:tenant_code/v1/me -> me.get")
|
|
router.Get("/t/:tenant_code/v1/me"[len(r.Path()):], DataFunc3(
|
|
r.me.get,
|
|
Local[*models.Tenant]("tenant"),
|
|
Local[*models.User]("user"),
|
|
Local[*models.TenantUser]("tenant_user"),
|
|
))
|
|
|
|
r.log.Info("Successfully registered all routes")
|
|
}
|