feat: update ui
This commit is contained in:
@@ -27,7 +27,7 @@ type posts struct {
|
||||
}
|
||||
|
||||
// List posts
|
||||
// @Router / [get]
|
||||
// @Router /api/posts [get]
|
||||
// @Bind pagination query
|
||||
// @Bind query query
|
||||
// @Bind user local
|
||||
@@ -37,14 +37,14 @@ func (ctl *posts) List(ctx fiber.Ctx, pagination *requests.Pagination, query *Li
|
||||
}
|
||||
|
||||
// Show
|
||||
// @Router /show/:id [get]
|
||||
// @Router /api/posts/show/:id [get]
|
||||
// @Bind id path
|
||||
func (ctl *posts) Show(ctx fiber.Ctx, id int64) (*model.Posts, error) {
|
||||
return models.Posts.GetByID(ctx.Context(), id)
|
||||
}
|
||||
|
||||
// Mine posts
|
||||
// @Router /mine [get]
|
||||
// @Router /api/posts/mine [get]
|
||||
// @Bind pagination query
|
||||
// @Bind query query
|
||||
func (ctl *posts) Mine(ctx fiber.Ctx, pagination *requests.Pagination, query *ListQuery) (*requests.Pager, error) {
|
||||
@@ -56,7 +56,7 @@ func (ctl *posts) Mine(ctx fiber.Ctx, pagination *requests.Pagination, query *Li
|
||||
var buyTpl string
|
||||
|
||||
// Buy
|
||||
// @Router /buy/:id [get]
|
||||
// @Router /api/posts/buy/:id [get]
|
||||
// @Bind id path
|
||||
func (ctl *posts) Buy(ctx fiber.Ctx, id int64) error {
|
||||
var userId int64 = 1
|
||||
|
||||
@@ -50,25 +50,25 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
))
|
||||
|
||||
// 注册路由组: posts
|
||||
router.Get("/", DataFunc3(
|
||||
router.Get("/api/posts", DataFunc3(
|
||||
r.posts.List,
|
||||
Query[requests.Pagination]("pagination"),
|
||||
Query[ListQuery]("query"),
|
||||
Local[*model.Users]("user"),
|
||||
))
|
||||
|
||||
router.Get("/show/:id", DataFunc1(
|
||||
router.Get("/api/posts/show/:id", DataFunc1(
|
||||
r.posts.Show,
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
|
||||
router.Get("/mine", DataFunc2(
|
||||
router.Get("/api/posts/mine", DataFunc2(
|
||||
r.posts.Mine,
|
||||
Query[requests.Pagination]("pagination"),
|
||||
Query[ListQuery]("query"),
|
||||
))
|
||||
|
||||
router.Get("/buy/:id", Func1(
|
||||
router.Get("/api/posts/buy/:id", Func1(
|
||||
r.posts.Buy,
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user