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

343 lines
14 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"
v1_dto "quyun/v2/app/http/v1/dto"
"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 v1 module.
//
// @provider contracts.HttpRoute atom.GroupRoutes
type Routes struct {
log *log.Entry `inject:"false"`
middlewares *middlewares.Middlewares
// Controller instances
contents *contents
coupons *coupons
creatorApplications *creatorApplications
creators *creators
orders *orders
payoutAccounts *payoutAccounts
reports *reports
tenants *tenants
users *users
withdrawals *withdrawals
}
// 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: Get /super/v1/contents/statistics -> contents.Statistics")
router.Get("/super/v1/contents/statistics"[len(r.Path()):], DataFunc1(
r.contents.Statistics,
Query[dto.SuperContentStatisticsFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/tenants/:tenantID<int>/contents -> contents.ListTenantContents")
router.Get("/super/v1/tenants/:tenantID<int>/contents"[len(r.Path()):], DataFunc2(
r.contents.ListTenantContents,
PathParam[int64]("tenantID"),
Query[dto.SuperContentListFilter]("filter"),
))
r.log.Debugf("Registering route: Patch /super/v1/tenants/:tenantID<int>/contents/:contentID<int>/status -> contents.UpdateStatus")
router.Patch("/super/v1/tenants/:tenantID<int>/contents/:contentID<int>/status"[len(r.Path()):], Func3(
r.contents.UpdateStatus,
PathParam[int64]("tenantID"),
PathParam[int64]("contentID"),
Body[dto.SuperTenantContentStatusUpdateForm]("form"),
))
r.log.Debugf("Registering route: Post /super/v1/contents/:id<int>/review -> contents.Review")
router.Post("/super/v1/contents/:id<int>/review"[len(r.Path()):], Func3(
r.contents.Review,
Local[*models.User]("__ctx_user"),
PathParam[int64]("id"),
Body[dto.SuperContentReviewForm]("form"),
))
r.log.Debugf("Registering route: Post /super/v1/contents/review/batch -> contents.BatchReview")
router.Post("/super/v1/contents/review/batch"[len(r.Path()):], Func2(
r.contents.BatchReview,
Local[*models.User]("__ctx_user"),
Body[dto.SuperContentBatchReviewForm]("form"),
))
// Register routes for controller: coupons
r.log.Debugf("Registering route: Get /super/v1/coupon-grants -> coupons.ListGrants")
router.Get("/super/v1/coupon-grants"[len(r.Path()):], DataFunc1(
r.coupons.ListGrants,
Query[dto.SuperCouponGrantListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/coupons -> coupons.List")
router.Get("/super/v1/coupons"[len(r.Path()):], DataFunc1(
r.coupons.List,
Query[dto.SuperCouponListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/tenants/:tenantID<int>/coupons/:id<int> -> coupons.Get")
router.Get("/super/v1/tenants/:tenantID<int>/coupons/:id<int>"[len(r.Path()):], DataFunc2(
r.coupons.Get,
PathParam[int64]("tenantID"),
PathParam[int64]("id"),
))
r.log.Debugf("Registering route: Patch /super/v1/coupons/:id<int>/status -> coupons.UpdateStatus")
router.Patch("/super/v1/coupons/:id<int>/status"[len(r.Path()):], Func3(
r.coupons.UpdateStatus,
Local[*models.User]("__ctx_user"),
PathParam[int64]("id"),
Body[dto.SuperCouponStatusUpdateForm]("form"),
))
r.log.Debugf("Registering route: Post /super/v1/tenants/:tenantID<int>/coupons -> coupons.Create")
router.Post("/super/v1/tenants/:tenantID<int>/coupons"[len(r.Path()):], DataFunc3(
r.coupons.Create,
Local[*models.User]("__ctx_user"),
PathParam[int64]("tenantID"),
Body[v1_dto.CouponCreateForm]("form"),
))
r.log.Debugf("Registering route: Post /super/v1/tenants/:tenantID<int>/coupons/:id<int>/grant -> coupons.Grant")
router.Post("/super/v1/tenants/:tenantID<int>/coupons/:id<int>/grant"[len(r.Path()):], DataFunc3(
r.coupons.Grant,
PathParam[int64]("tenantID"),
PathParam[int64]("id"),
Body[v1_dto.CouponGrantForm]("form"),
))
r.log.Debugf("Registering route: Put /super/v1/tenants/:tenantID<int>/coupons/:id<int> -> coupons.Update")
router.Put("/super/v1/tenants/:tenantID<int>/coupons/:id<int>"[len(r.Path()):], DataFunc4(
r.coupons.Update,
Local[*models.User]("__ctx_user"),
PathParam[int64]("tenantID"),
PathParam[int64]("id"),
Body[v1_dto.CouponUpdateForm]("form"),
))
// Register routes for controller: creatorApplications
r.log.Debugf("Registering route: Get /super/v1/creator-applications -> creatorApplications.List")
router.Get("/super/v1/creator-applications"[len(r.Path()):], DataFunc1(
r.creatorApplications.List,
Query[dto.TenantListFilter]("filter"),
))
r.log.Debugf("Registering route: Post /super/v1/creator-applications/:id<int>/review -> creatorApplications.Review")
router.Post("/super/v1/creator-applications/:id<int>/review"[len(r.Path()):], Func3(
r.creatorApplications.Review,
Local[*models.User]("__ctx_user"),
PathParam[int64]("id"),
Body[dto.SuperCreatorApplicationReviewForm]("form"),
))
// Register routes for controller: creators
r.log.Debugf("Registering route: Get /super/v1/creators -> creators.List")
router.Get("/super/v1/creators"[len(r.Path()):], DataFunc1(
r.creators.List,
Query[dto.TenantListFilter]("filter"),
))
// 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<int> -> orders.Get")
router.Get("/super/v1/orders/:id<int>"[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<int>/refund -> orders.Refund")
router.Post("/super/v1/orders/:id<int>/refund"[len(r.Path()):], Func2(
r.orders.Refund,
PathParam[int64]("id"),
Body[dto.SuperOrderRefundForm]("form"),
))
// Register routes for controller: payoutAccounts
r.log.Debugf("Registering route: Delete /super/v1/payout-accounts/:id<int> -> payoutAccounts.Remove")
router.Delete("/super/v1/payout-accounts/:id<int>"[len(r.Path()):], Func2(
r.payoutAccounts.Remove,
Local[*models.User]("__ctx_user"),
PathParam[int64]("id"),
))
r.log.Debugf("Registering route: Get /super/v1/payout-accounts -> payoutAccounts.List")
router.Get("/super/v1/payout-accounts"[len(r.Path()):], DataFunc1(
r.payoutAccounts.List,
Query[dto.SuperPayoutAccountListFilter]("filter"),
))
// Register routes for controller: reports
r.log.Debugf("Registering route: Get /super/v1/reports/overview -> reports.Overview")
router.Get("/super/v1/reports/overview"[len(r.Path()):], DataFunc1(
r.reports.Overview,
Query[dto.SuperReportOverviewFilter]("filter"),
))
r.log.Debugf("Registering route: Post /super/v1/reports/export -> reports.Export")
router.Post("/super/v1/reports/export"[len(r.Path()):], DataFunc1(
r.reports.Export,
Body[dto.SuperReportExportForm]("form"),
))
// Register routes for controller: tenants
r.log.Debugf("Registering route: Get /super/v1/tenant-join-requests -> tenants.ListJoinRequests")
router.Get("/super/v1/tenant-join-requests"[len(r.Path()):], DataFunc1(
r.tenants.ListJoinRequests,
Query[dto.SuperTenantJoinRequestListFilter]("filter"),
))
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<int> -> tenants.Get")
router.Get("/super/v1/tenants/:id<int>"[len(r.Path()):], DataFunc1(
r.tenants.Get,
PathParam[int64]("id"),
))
r.log.Debugf("Registering route: Get /super/v1/tenants/:tenantID<int>/users -> tenants.ListUsers")
router.Get("/super/v1/tenants/:tenantID<int>/users"[len(r.Path()):], DataFunc2(
r.tenants.ListUsers,
PathParam[int64]("tenantID"),
Query[dto.SuperTenantUserListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/tenants/health -> tenants.Health")
router.Get("/super/v1/tenants/health"[len(r.Path()):], DataFunc1(
r.tenants.Health,
Query[dto.TenantListFilter]("filter"),
))
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<int> -> tenants.UpdateExpire")
router.Patch("/super/v1/tenants/:id<int>"[len(r.Path()):], Func2(
r.tenants.UpdateExpire,
PathParam[int64]("id"),
Body[dto.TenantExpireUpdateForm]("form"),
))
r.log.Debugf("Registering route: Patch /super/v1/tenants/:id<int>/status -> tenants.UpdateStatus")
router.Patch("/super/v1/tenants/:id<int>/status"[len(r.Path()):], Func2(
r.tenants.UpdateStatus,
PathParam[int64]("id"),
Body[dto.TenantStatusUpdateForm]("form"),
))
r.log.Debugf("Registering route: Post /super/v1/tenant-join-requests/:id<int>/review -> tenants.ReviewJoinRequest")
router.Post("/super/v1/tenant-join-requests/:id<int>/review"[len(r.Path()):], Func3(
r.tenants.ReviewJoinRequest,
Local[*models.User]("__ctx_user"),
PathParam[int64]("id"),
Body[v1_dto.TenantJoinReviewForm]("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"),
))
r.log.Debugf("Registering route: Post /super/v1/tenants/:tenantID<int>/invites -> tenants.CreateInvite")
router.Post("/super/v1/tenants/:tenantID<int>/invites"[len(r.Path()):], DataFunc2(
r.tenants.CreateInvite,
PathParam[int64]("tenantID"),
Body[v1_dto.TenantInviteCreateForm]("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<int> -> users.Get")
router.Get("/super/v1/users/:id<int>"[len(r.Path()):], DataFunc1(
r.users.Get,
PathParam[int64]("id"),
))
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/coupons -> users.ListCoupons")
router.Get("/super/v1/users/:id<int>/coupons"[len(r.Path()):], DataFunc2(
r.users.ListCoupons,
PathParam[int64]("id"),
Query[dto.SuperUserCouponListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/notifications -> users.ListNotifications")
router.Get("/super/v1/users/:id<int>/notifications"[len(r.Path()):], DataFunc2(
r.users.ListNotifications,
PathParam[int64]("id"),
Query[dto.SuperUserNotificationListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/realname -> users.RealName")
router.Get("/super/v1/users/:id<int>/realname"[len(r.Path()):], DataFunc1(
r.users.RealName,
PathParam[int64]("id"),
))
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/tenants -> users.ListTenants")
router.Get("/super/v1/users/:id<int>/tenants"[len(r.Path()):], DataFunc2(
r.users.ListTenants,
PathParam[int64]("id"),
Query[dto.SuperUserTenantListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/wallet -> users.Wallet")
router.Get("/super/v1/users/:id<int>/wallet"[len(r.Path()):], DataFunc1(
r.users.Wallet,
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<int>/roles -> users.UpdateRoles")
router.Patch("/super/v1/users/:id<int>/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<int>/status -> users.UpdateStatus")
router.Patch("/super/v1/users/:id<int>/status"[len(r.Path()):], Func2(
r.users.UpdateStatus,
PathParam[int64]("id"),
Body[dto.UserStatusUpdateForm]("form"),
))
// Register routes for controller: withdrawals
r.log.Debugf("Registering route: Get /super/v1/withdrawals -> withdrawals.List")
router.Get("/super/v1/withdrawals"[len(r.Path()):], DataFunc1(
r.withdrawals.List,
Query[dto.SuperOrderListFilter]("filter"),
))
r.log.Debugf("Registering route: Post /super/v1/withdrawals/:id<int>/approve -> withdrawals.Approve")
router.Post("/super/v1/withdrawals/:id<int>/approve"[len(r.Path()):], Func2(
r.withdrawals.Approve,
Local[*models.User]("__ctx_user"),
PathParam[int64]("id"),
))
r.log.Debugf("Registering route: Post /super/v1/withdrawals/:id<int>/reject -> withdrawals.Reject")
router.Post("/super/v1/withdrawals/:id<int>/reject"[len(r.Path()):], Func3(
r.withdrawals.Reject,
Local[*models.User]("__ctx_user"),
PathParam[int64]("id"),
Body[dto.SuperWithdrawalRejectForm]("form"),
))
r.log.Info("Successfully registered all routes")
}