fix: stabilize backend tests

This commit is contained in:
2026-01-08 14:07:58 +08:00
parent 7f1d2e7cb3
commit edbb62449b
18 changed files with 281 additions and 147 deletions

View File

@@ -50,8 +50,8 @@ func (r *Routes) Register(router fiber.Router) {
r.contents.List,
Query[dto.SuperContentListFilter]("filter"),
))
r.log.Debugf("Registering route: Patch /super/v1/tenants/:tenantID/contents/:contentID/status -> contents.UpdateStatus")
router.Patch("/super/v1/tenants/:tenantID/contents/:contentID/status"[len(r.Path()):], Func3(
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"),
@@ -63,8 +63,8 @@ func (r *Routes) Register(router fiber.Router) {
r.orders.List,
Query[dto.SuperOrderListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/orders/:id -> orders.Get")
router.Get("/super/v1/orders/:id"[len(r.Path()):], DataFunc1(
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"),
))
@@ -72,8 +72,8 @@ func (r *Routes) Register(router fiber.Router) {
router.Get("/super/v1/orders/statistics"[len(r.Path()):], DataFunc0(
r.orders.Statistics,
))
r.log.Debugf("Registering route: Post /super/v1/orders/:id/refund -> orders.Refund")
router.Post("/super/v1/orders/:id/refund"[len(r.Path()):], Func2(
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"),
@@ -84,8 +84,8 @@ func (r *Routes) Register(router fiber.Router) {
r.tenants.List,
Query[dto.TenantListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/tenants/:id -> tenants.Get")
router.Get("/super/v1/tenants/:id"[len(r.Path()):], DataFunc1(
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"),
))
@@ -93,14 +93,14 @@ func (r *Routes) Register(router fiber.Router) {
router.Get("/super/v1/tenants/statuses"[len(r.Path()):], DataFunc0(
r.tenants.Statuses,
))
r.log.Debugf("Registering route: Patch /super/v1/tenants/:id -> tenants.UpdateExpire")
router.Patch("/super/v1/tenants/:id"[len(r.Path()):], Func2(
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/status -> tenants.UpdateStatus")
router.Patch("/super/v1/tenants/:id/status"[len(r.Path()):], Func2(
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"),
@@ -116,8 +116,8 @@ func (r *Routes) Register(router fiber.Router) {
r.users.List,
Query[dto.UserListFilter]("filter"),
))
r.log.Debugf("Registering route: Get /super/v1/users/:id -> users.Get")
router.Get("/super/v1/users/:id"[len(r.Path()):], DataFunc1(
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"),
))
@@ -129,14 +129,14 @@ func (r *Routes) Register(router fiber.Router) {
router.Get("/super/v1/users/statuses"[len(r.Path()):], DataFunc0(
r.users.Statuses,
))
r.log.Debugf("Registering route: Patch /super/v1/users/:id/roles -> users.UpdateRoles")
router.Patch("/super/v1/users/:id/roles"[len(r.Path()):], Func2(
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/status -> users.UpdateStatus")
router.Patch("/super/v1/users/:id/status"[len(r.Path()):], Func2(
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"),