Files
quyun/backend/app/http/routes.gen.go
2025-04-29 14:22:55 +08:00

99 lines
1.9 KiB
Go

// Code generated by the atomctl ; DO NOT EDIT.
package http
import (
"github.com/gofiber/fiber/v3"
log "github.com/sirupsen/logrus"
_ "go.ipao.vip/atom"
_ "go.ipao.vip/atom/contracts"
. "go.ipao.vip/atom/fen"
"quyun/app/requests"
"quyun/database/schemas/public/model"
)
// @provider contracts.HttpRoute atom.GroupRoutes
type Routes struct {
log *log.Entry `inject:"false"`
auth *auth
pays *pays
posts *posts
users *users
}
func (r *Routes) Prepare() error {
r.log = log.WithField("module", "routes.http")
return nil
}
func (r *Routes) Name() string {
return "http"
}
func (r *Routes) Register(router fiber.Router) {
// 注册路由组: auth
router.Get("/auth/login", Func3(
r.auth.Login,
QueryParam[string]("code"),
QueryParam[string]("state"),
QueryParam[string]("redirect"),
))
router.Get("/auth/wechat", Func1(
r.auth.Wechat,
QueryParam[string]("redirect"),
))
// 注册路由组: pays
router.Get("/pay/callback/:channel", Func1(
r.pays.Callback,
PathParam[string]("channel"),
))
// 注册路由组: posts
router.Get("/posts", DataFunc3(
r.posts.List,
Query[requests.Pagination]("pagination"),
Query[ListQuery]("query"),
Local[*model.Users]("user"),
))
router.Get("/posts/:id/show", DataFunc2(
r.posts.Show,
PathParam[int64]("id"),
Local[*model.Users]("user"),
))
router.Get("/posts/:id/play", DataFunc2(
r.posts.Play,
PathParam[int64]("id"),
Local[*model.Users]("user"),
))
router.Get("/posts/mine", DataFunc3(
r.posts.Mine,
Query[requests.Pagination]("pagination"),
Query[ListQuery]("query"),
Local[*model.Users]("user"),
))
router.Get("/posts/:id/buy", DataFunc2(
r.posts.Buy,
PathParam[int64]("id"),
Local[*model.Users]("user"),
))
// 注册路由组: users
router.Get("/users/profile", DataFunc1(
r.users.Profile,
Local[*model.Users]("user"),
))
router.Put("/users/username", Func2(
r.users.Update,
Local[*model.Users]("user"),
Body[ProfileForm]("form"),
))
}