56 lines
1.1 KiB
Go
56 lines
1.1 KiB
Go
// Code generated by the atomctl ; DO NOT EDIT.
|
|
|
|
package storages
|
|
|
|
import (
|
|
. "backend/pkg/f"
|
|
|
|
_ "git.ipao.vip/rogeecn/atom"
|
|
_ "git.ipao.vip/rogeecn/atom/contracts"
|
|
"github.com/gofiber/fiber/v3"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// @provider contracts.HttpRoute atom.GroupRoutes
|
|
type Routes struct {
|
|
log *log.Entry `inject:"false"`
|
|
controller *Controller
|
|
}
|
|
|
|
func (r *Routes) Prepare() error {
|
|
r.log = log.WithField("module", "routes.storages")
|
|
return nil
|
|
}
|
|
|
|
func (r *Routes) Name() string {
|
|
return "storages"
|
|
}
|
|
|
|
func (r *Routes) Register(router fiber.Router) {
|
|
// 注册路由组: Controller
|
|
router.Get("/api/v1/storages", DataFunc0(
|
|
r.controller.List,
|
|
))
|
|
|
|
router.Get("/api/v1/storages/:id", DataFunc1(
|
|
r.controller.Show,
|
|
PathParam[int64]("id"),
|
|
))
|
|
|
|
router.Delete("/api/v1/storages/:id", Func1(
|
|
r.controller.Delete,
|
|
PathParam[int64]("id"),
|
|
))
|
|
|
|
router.Post("/api/v1/storages", Func1(
|
|
r.controller.Create,
|
|
Body[CreateStorageReq]("req"),
|
|
))
|
|
|
|
router.Put("/api/v1/storages/:id/default", Func1(
|
|
r.controller.SetDefault,
|
|
PathParam[int64]("id"),
|
|
))
|
|
|
|
}
|