feat: update module
This commit is contained in:
@@ -8,15 +8,13 @@ import (
|
||||
_ "go.ipao.vip/atom"
|
||||
_ "go.ipao.vip/atom/contracts"
|
||||
. "go.ipao.vip/atom/fen"
|
||||
"mime/multipart"
|
||||
"quyun/app/requests"
|
||||
)
|
||||
|
||||
// @provider contracts.HttpRoute atom.GroupRoutes
|
||||
type Routes struct {
|
||||
log *log.Entry `inject:"false"`
|
||||
medias *medias
|
||||
uploads *uploads
|
||||
log *log.Entry `inject:"false"`
|
||||
posts *posts
|
||||
}
|
||||
|
||||
func (r *Routes) Prepare() error {
|
||||
@@ -29,24 +27,16 @@ func (r *Routes) Name() string {
|
||||
}
|
||||
|
||||
func (r *Routes) Register(router fiber.Router) {
|
||||
// 注册路由组: medias
|
||||
router.Get("/v1/medias", DataFunc1(
|
||||
r.medias.List,
|
||||
// 注册路由组: posts
|
||||
router.Get("/v1/posts", DataFunc2(
|
||||
r.posts.List,
|
||||
Query[requests.Pagination]("pagination"),
|
||||
Query[ListQuery]("query"),
|
||||
))
|
||||
|
||||
// 注册路由组: uploads
|
||||
router.Post("/v1/uploads/:md5/chunks/:idx", Func3(
|
||||
r.uploads.Chunks,
|
||||
PathParam[string]("md5"),
|
||||
PathParam[string]("idx"),
|
||||
File[multipart.FileHeader]("file"),
|
||||
))
|
||||
|
||||
router.Post("/v1/uploads/:md5/complete", Func2(
|
||||
r.uploads.Complete,
|
||||
PathParam[string]("md5"),
|
||||
Body[UploadFileInfo]("body"),
|
||||
router.Get("/v1/posts/:id", DataFunc1(
|
||||
r.posts.Show,
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user