package admin import ( "quyun/app/models" "quyun/app/requests" "quyun/database/schemas/public/model" "github.com/gofiber/fiber/v3" ) type ListQuery struct { Keyword *string `query:"keyword"` } // @provider type posts struct{} // List posts // @Router /v1/admin/posts [get] // @Bind pagination query // @Bind query query func (ctl *posts) List(ctx fiber.Ctx, pagination *requests.Pagination, query *ListQuery) (*requests.Pager, error) { cond := models.Posts.BuildConditionWithKey(query.Keyword) return models.Posts.List(ctx.Context(), pagination, cond) } // Create // @Router /v1/admin/posts [post] // @Bind form body func (ctl *posts) Create(ctx fiber.Ctx, form *model.Posts) error { return nil } // Update posts // @Router /v1/admin/posts/:id [put] // @Bind id path // @Bind form body func (ctl *posts) Update(ctx fiber.Ctx, id int64, form *model.Posts) error { return nil }