feat: add superadmin assets and notifications

This commit is contained in:
2026-01-15 15:28:41 +08:00
parent c683fa5cf3
commit b896d0fa00
22 changed files with 4852 additions and 260 deletions

View File

@@ -25,10 +25,12 @@ type Routes struct {
log *log.Entry `inject:"false"`
middlewares *middlewares.Middlewares
// Controller instances
assets *assets
contents *contents
coupons *coupons
creatorApplications *creatorApplications
creators *creators
notifications *notifications
orders *orders
payoutAccounts *payoutAccounts
reports *reports
@@ -52,6 +54,23 @@ func (r *Routes) Name() string {
// 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: assets
r.log.Debugf("Registering route: Delete /super/v1/assets/:id<int> -> assets.Delete")
router.Delete("/super/v1/assets/:id<int>"[len(r.Path()):], Func2(
r.assets.Delete,
PathParam[int64]("id"),
Query[dto.SuperAssetDeleteQuery]("query"),
))
r.log.Debugf("Registering route: Get /super/v1/assets -> assets.List")
router.Get("/super/v1/assets"[len(r.Path()):], DataFunc1(
r.assets.List,
Query[dto.SuperAssetListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/assets/usage -> assets.Usage")
router.Get("/super/v1/assets/usage"[len(r.Path()):], DataFunc1(
r.assets.Usage,
Query[dto.SuperAssetUsageFilter]("filter"),
))
// 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(
@@ -154,6 +173,27 @@ func (r *Routes) Register(router fiber.Router) {
r.creators.List,
Query[dto.TenantListFilter]("filter"),
))
// Register routes for controller: notifications
r.log.Debugf("Registering route: Get /super/v1/notifications -> notifications.List")
router.Get("/super/v1/notifications"[len(r.Path()):], DataFunc1(
r.notifications.List,
Query[dto.SuperNotificationListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/notifications/templates -> notifications.ListTemplates")
router.Get("/super/v1/notifications/templates"[len(r.Path()):], DataFunc1(
r.notifications.ListTemplates,
Query[dto.SuperNotificationTemplateListFilter]("filter"),
))
r.log.Debugf("Registering route: Post /super/v1/notifications/broadcast -> notifications.Broadcast")
router.Post("/super/v1/notifications/broadcast"[len(r.Path()):], Func1(
r.notifications.Broadcast,
Body[dto.SuperNotificationBroadcastForm]("form"),
))
r.log.Debugf("Registering route: Post /super/v1/notifications/templates -> notifications.CreateTemplate")
router.Post("/super/v1/notifications/templates"[len(r.Path()):], DataFunc1(
r.notifications.CreateTemplate,
Body[dto.SuperNotificationTemplateCreateForm]("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(