feat: wire superadmin p1 data

This commit is contained in:
2026-01-15 09:35:16 +08:00
parent bb4c5b39d2
commit 235a216b0c
21 changed files with 3188 additions and 28 deletions

View File

@@ -24,10 +24,14 @@ type Routes struct {
log *log.Entry `inject:"false"`
middlewares *middlewares.Middlewares
// Controller instances
contents *contents
orders *orders
tenants *tenants
users *users
contents *contents
coupons *coupons
creators *creators
orders *orders
reports *reports
tenants *tenants
users *users
withdrawals *withdrawals
}
// Prepare initializes the routes provider with logging configuration.
@@ -71,6 +75,18 @@ func (r *Routes) Register(router fiber.Router) {
PathParam[int64]("id"),
Body[dto.SuperContentReviewForm]("form"),
))
// Register routes for controller: coupons
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"),
))
// 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(
@@ -92,6 +108,17 @@ func (r *Routes) Register(router fiber.Router) {
PathParam[int64]("id"),
Body[dto.SuperOrderRefundForm]("form"),
))
// 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/tenants -> tenants.List")
router.Get("/super/v1/tenants"[len(r.Path()):], DataFunc1(
@@ -172,6 +199,25 @@ func (r *Routes) Register(router fiber.Router) {
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")
}