Files
quyun-v2/backend/app/http/super/v1/routes.gen.go

147 lines
5.3 KiB
Go

// Code generated by atomctl. DO NOT EDIT.
// Package v1 provides HTTP route definitions and registration
// for the quyun/v2 application.
package v1
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 v1 module.
//
// @provider contracts.HttpRoute atom.GroupRoutes
type Routes struct {
log *log.Entry `inject:"false"`
middlewares *middlewares.Middlewares
// Controller instances
contents *contents
orders *orders
tenants *tenants
users *users
}
// Prepare initializes the routes provider with logging configuration.
func (r *Routes) Prepare() error {
r.log = log.WithField("module", "routes.v1")
r.log.Info("Initializing routes module")
return nil
}
// Name returns the unique identifier for this routes provider.
func (r *Routes) Name() string {
return "v1"
}
// 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: contents
r.log.Debugf("Registering route: Get /super/v1/contents -> contents.List")
router.Get("/super/v1/contents"[len(r.Path()):], DataFunc1(
r.contents.List,
Query[dto.SuperContentListFilter]("filter"),
))
r.log.Debugf("Registering route: Patch /super/v1/tenants/:tenantID/contents/:contentID/status -> contents.UpdateStatus")
router.Patch("/super/v1/tenants/:tenantID/contents/:contentID/status"[len(r.Path()):], Func3(
r.contents.UpdateStatus,
PathParam[int64]("tenantID"),
PathParam[int64]("contentID"),
Body[dto.SuperTenantContentStatusUpdateForm]("form"),
))
// Register routes for controller: orders
r.log.Debugf("Registering route: Get /super/v1/orders -> orders.List")
router.Get("/super/v1/orders"[len(r.Path()):], DataFunc1(
r.orders.List,
Query[dto.SuperOrderListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/orders/:id -> orders.Get")
router.Get("/super/v1/orders/:id"[len(r.Path()):], DataFunc1(
r.orders.Get,
PathParam[int64]("id"),
))
r.log.Debugf("Registering route: Get /super/v1/orders/statistics -> orders.Statistics")
router.Get("/super/v1/orders/statistics"[len(r.Path()):], DataFunc0(
r.orders.Statistics,
))
r.log.Debugf("Registering route: Post /super/v1/orders/:id/refund -> orders.Refund")
router.Post("/super/v1/orders/:id/refund"[len(r.Path()):], Func2(
r.orders.Refund,
PathParam[int64]("id"),
Body[dto.SuperOrderRefundForm]("form"),
))
// Register routes for controller: tenants
r.log.Debugf("Registering route: Get /super/v1/tenants -> tenants.List")
router.Get("/super/v1/tenants"[len(r.Path()):], DataFunc1(
r.tenants.List,
Query[dto.TenantListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/tenants/:id -> tenants.Get")
router.Get("/super/v1/tenants/:id"[len(r.Path()):], DataFunc1(
r.tenants.Get,
PathParam[int64]("id"),
))
r.log.Debugf("Registering route: Get /super/v1/tenants/statuses -> tenants.Statuses")
router.Get("/super/v1/tenants/statuses"[len(r.Path()):], DataFunc0(
r.tenants.Statuses,
))
r.log.Debugf("Registering route: Patch /super/v1/tenants/:id -> tenants.UpdateExpire")
router.Patch("/super/v1/tenants/:id"[len(r.Path()):], Func2(
r.tenants.UpdateExpire,
PathParam[int64]("id"),
Body[dto.TenantExpireUpdateForm]("form"),
))
r.log.Debugf("Registering route: Patch /super/v1/tenants/:id/status -> tenants.UpdateStatus")
router.Patch("/super/v1/tenants/:id/status"[len(r.Path()):], Func2(
r.tenants.UpdateStatus,
PathParam[int64]("id"),
Body[dto.TenantStatusUpdateForm]("form"),
))
r.log.Debugf("Registering route: Post /super/v1/tenants -> tenants.Create")
router.Post("/super/v1/tenants"[len(r.Path()):], Func1(
r.tenants.Create,
Body[dto.TenantCreateForm]("form"),
))
// Register routes for controller: users
r.log.Debugf("Registering route: Get /super/v1/users -> users.List")
router.Get("/super/v1/users"[len(r.Path()):], DataFunc1(
r.users.List,
Query[dto.UserListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/users/:id -> users.Get")
router.Get("/super/v1/users/:id"[len(r.Path()):], DataFunc1(
r.users.Get,
PathParam[int64]("id"),
))
r.log.Debugf("Registering route: Get /super/v1/users/statistics -> users.Statistics")
router.Get("/super/v1/users/statistics"[len(r.Path()):], DataFunc0(
r.users.Statistics,
))
r.log.Debugf("Registering route: Get /super/v1/users/statuses -> users.Statuses")
router.Get("/super/v1/users/statuses"[len(r.Path()):], DataFunc0(
r.users.Statuses,
))
r.log.Debugf("Registering route: Patch /super/v1/users/:id/roles -> users.UpdateRoles")
router.Patch("/super/v1/users/:id/roles"[len(r.Path()):], Func2(
r.users.UpdateRoles,
PathParam[int64]("id"),
Body[dto.UserRolesUpdateForm]("form"),
))
r.log.Debugf("Registering route: Patch /super/v1/users/:id/status -> users.UpdateStatus")
router.Patch("/super/v1/users/:id/status"[len(r.Path()):], Func2(
r.users.UpdateStatus,
PathParam[int64]("id"),
Body[dto.UserStatusUpdateForm]("form"),
))
r.log.Info("Successfully registered all routes")
}