This commit is contained in:
93
backend_v1/app/http/routes.gen.go
Normal file
93
backend_v1/app/http/routes.gen.go
Normal file
@@ -0,0 +1,93 @@
|
||||
// Code generated by atomctl. DO NOT EDIT.
|
||||
|
||||
// Package http provides HTTP route definitions and registration
|
||||
// for the quyun/v2 application.
|
||||
package http
|
||||
|
||||
import (
|
||||
"quyun/v2/app/middlewares"
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/database/models"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
log "github.com/sirupsen/logrus"
|
||||
_ "go.ipao.vip/atom"
|
||||
_ "go.ipao.vip/atom/contracts"
|
||||
. "go.ipao.vip/atom/fen"
|
||||
)
|
||||
|
||||
// Routes implements the HttpRoute contract and provides route registration
|
||||
// for all controllers in the http module.
|
||||
//
|
||||
// @provider contracts.HttpRoute atom.GroupRoutes
|
||||
type Routes struct {
|
||||
log *log.Entry `inject:"false"`
|
||||
middlewares *middlewares.Middlewares
|
||||
// Controller instances
|
||||
posts *posts
|
||||
users *users
|
||||
}
|
||||
|
||||
// Prepare initializes the routes provider with logging configuration.
|
||||
func (r *Routes) Prepare() error {
|
||||
r.log = log.WithField("module", "routes.http")
|
||||
r.log.Info("Initializing routes module")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Name returns the unique identifier for this routes provider.
|
||||
func (r *Routes) Name() string {
|
||||
return "http"
|
||||
}
|
||||
|
||||
// Register registers all HTTP routes with the provided fiber router.
|
||||
// Each route is registered with its corresponding controller action and parameter bindings.
|
||||
func (r *Routes) Register(router fiber.Router) {
|
||||
// Register routes for controller: posts
|
||||
r.log.Debugf("Registering route: Get /posts -> posts.List")
|
||||
router.Get("/posts"[len(r.Path()):], DataFunc3(
|
||||
r.posts.List,
|
||||
Query[requests.Pagination]("pagination"),
|
||||
Query[ListQuery]("query"),
|
||||
Local[*models.User]("user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /posts/:id/play -> posts.Play")
|
||||
router.Get("/posts/:id/play"[len(r.Path()):], DataFunc2(
|
||||
r.posts.Play,
|
||||
PathParam[int64]("id"),
|
||||
Local[*models.User]("user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /posts/:id/show -> posts.Show")
|
||||
router.Get("/posts/:id/show"[len(r.Path()):], DataFunc2(
|
||||
r.posts.Show,
|
||||
PathParam[int64]("id"),
|
||||
Local[*models.User]("user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /posts/mine -> posts.Mine")
|
||||
router.Get("/posts/mine"[len(r.Path()):], DataFunc3(
|
||||
r.posts.Mine,
|
||||
Query[requests.Pagination]("pagination"),
|
||||
Query[ListQuery]("query"),
|
||||
Local[*models.User]("user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /posts/:id/buy -> posts.Buy")
|
||||
router.Post("/posts/:id/buy"[len(r.Path()):], DataFunc2(
|
||||
r.posts.Buy,
|
||||
PathParam[int64]("id"),
|
||||
Local[*models.User]("user"),
|
||||
))
|
||||
// Register routes for controller: users
|
||||
r.log.Debugf("Registering route: Get /users/profile -> users.Profile")
|
||||
router.Get("/users/profile"[len(r.Path()):], DataFunc1(
|
||||
r.users.Profile,
|
||||
Local[*models.User]("user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Put /users/username -> users.Update")
|
||||
router.Put("/users/username"[len(r.Path()):], Func2(
|
||||
r.users.Update,
|
||||
Local[*models.User]("user"),
|
||||
Body[ProfileForm]("form"),
|
||||
))
|
||||
|
||||
r.log.Info("Successfully registered all routes")
|
||||
}
|
||||
Reference in New Issue
Block a user