feat: add superadmin creator review and coupon governance

This commit is contained in:
2026-01-15 13:14:25 +08:00
parent bec984b959
commit 539cdf3c1c
17 changed files with 2909 additions and 146 deletions

View File

@@ -25,14 +25,16 @@ type Routes struct {
log *log.Entry `inject:"false"`
middlewares *middlewares.Middlewares
// Controller instances
contents *contents
coupons *coupons
creators *creators
orders *orders
reports *reports
tenants *tenants
users *users
withdrawals *withdrawals
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.
@@ -83,6 +85,11 @@ func (r *Routes) Register(router fiber.Router) {
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,
@@ -94,6 +101,13 @@ func (r *Routes) Register(router fiber.Router) {
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,
@@ -116,6 +130,19 @@ func (r *Routes) Register(router fiber.Router) {
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(
@@ -143,6 +170,18 @@ func (r *Routes) Register(router fiber.Router) {
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(