feat: 重构内容和订单列表接口,使用过滤器结构体简化参数传递;更新相关服务和测试用例

This commit is contained in:
2025-12-29 15:41:48 +08:00
parent fba77afec1
commit 9d598e7f9b
11 changed files with 286 additions and 232 deletions

View File

@@ -111,21 +111,18 @@ func (r *Routes) Register(router fiber.Router) {
QueryParam[string]("id"),
))
r.log.Debugf("Registering route: Get /v1/creator/contents -> creator.ListContents")
router.Get("/v1/creator/contents"[len(r.Path()):], DataFunc3(
router.Get("/v1/creator/contents"[len(r.Path()):], DataFunc1(
r.creator.ListContents,
QueryParam[string]("status"),
QueryParam[string]("genre"),
QueryParam[string]("keyword"),
Query[dto.CreatorContentListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /v1/creator/dashboard -> creator.Dashboard")
router.Get("/v1/creator/dashboard"[len(r.Path()):], DataFunc0(
r.creator.Dashboard,
))
r.log.Debugf("Registering route: Get /v1/creator/orders -> creator.ListOrders")
router.Get("/v1/creator/orders"[len(r.Path()):], DataFunc2(
router.Get("/v1/creator/orders"[len(r.Path()):], DataFunc1(
r.creator.ListOrders,
QueryParam[string]("status"),
QueryParam[string]("keyword"),
Query[dto.CreatorOrderListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /v1/creator/payout-accounts -> creator.ListPayoutAccounts")
router.Get("/v1/creator/payout-accounts"[len(r.Path()):], DataFunc0(
@@ -178,16 +175,14 @@ func (r *Routes) Register(router fiber.Router) {
r.super.CheckToken,
))
r.log.Debugf("Registering route: Get /v1/contents -> super.ListContents")
router.Get("/v1/contents"[len(r.Path()):], DataFunc2(
router.Get("/v1/contents"[len(r.Path()):], DataFunc1(
r.super.ListContents,
QueryParam[int]("page"),
QueryParam[int]("limit"),
Query[dto.SuperContentListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /v1/orders -> super.ListOrders")
router.Get("/v1/orders"[len(r.Path()):], DataFunc2(
router.Get("/v1/orders"[len(r.Path()):], DataFunc1(
r.super.ListOrders,
QueryParam[int]("page"),
QueryParam[int]("limit"),
Query[dto.SuperOrderListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /v1/orders/:id -> super.GetOrder")
router.Get("/v1/orders/:id"[len(r.Path()):], DataFunc1(
@@ -199,11 +194,9 @@ func (r *Routes) Register(router fiber.Router) {
r.super.OrderStatistics,
))
r.log.Debugf("Registering route: Get /v1/tenants -> super.ListTenants")
router.Get("/v1/tenants"[len(r.Path()):], DataFunc3(
router.Get("/v1/tenants"[len(r.Path()):], DataFunc1(
r.super.ListTenants,
QueryParam[int]("page"),
QueryParam[int]("limit"),
QueryParam[string]("name"),
Query[dto.TenantListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /v1/tenants/:id -> super.GetTenant")
router.Get("/v1/tenants/:id"[len(r.Path()):], DataFunc1(
@@ -215,11 +208,9 @@ func (r *Routes) Register(router fiber.Router) {
r.super.TenantStatuses,
))
r.log.Debugf("Registering route: Get /v1/users -> super.ListUsers")
router.Get("/v1/users"[len(r.Path()):], DataFunc3(
router.Get("/v1/users"[len(r.Path()):], DataFunc1(
r.super.ListUsers,
QueryParam[int]("page"),
QueryParam[int]("limit"),
QueryParam[string]("username"),
Query[dto.UserListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /v1/users/:id -> super.GetUser")
router.Get("/v1/users/:id"[len(r.Path()):], DataFunc1(