feat: 添加作品购买人列表功能
Some checks failed
build quyun / Build (push) Failing after 1m26s

This commit is contained in:
2025-12-20 23:09:01 +08:00
parent e2be734b82
commit 65d40fa631
8 changed files with 223 additions and 7 deletions

View File

@@ -114,6 +114,15 @@ func (r *Routes) Register(router fiber.Router) {
return models.PostQuery.WithContext(ctx).Where(field.NewUnsafeFieldRaw("id = ?", v)).First()
},
))
r.log.Debugf("Registering route: Get /admin/v1/posts/:id/buyers -> posts.Buyers")
router.Get("/admin/v1/posts/:id/buyers"[len(r.Path()):], DataFunc2(
r.posts.Buyers,
func(ctx fiber.Ctx) (*models.Post, error) {
v := fiber.Params[int](ctx, "id")
return models.PostQuery.WithContext(ctx).Where(field.NewUnsafeFieldRaw("id = ?", v)).First()
},
Query[requests.Pagination]("pagination"),
))
r.log.Debugf("Registering route: Post /admin/v1/posts -> posts.Create")
router.Post("/admin/v1/posts"[len(r.Path()):], Func1(
r.posts.Create,