evaluation_cycle_router.go 1.0 KB
package routers

import (
	"github.com/beego/beego/v2/server/web"
	"github.com/linmadan/egglib-go/web/beego/filters"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/controllers"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)

func init() {
	ns := web.NewNamespace("/v1/evaluation-cycle",
		web.NSBefore(filters.AllowCors(), middlewares.CheckAdminToken()),
		web.NSRouter("/", &controllers.CycleController{}, "Post:CreateCycle"),
		web.NSRouter("/", &controllers.CycleController{}, "Put:UpdateCycle"),
		web.NSRouter("/", &controllers.CycleController{}, "Delete:RemoveCycle"),
		web.NSRouter("/:Id", &controllers.CycleController{}, "Get:GetCycle"),
		web.NSRouter("/list", &controllers.CycleController{}, "Post:ListCycle"),
		web.NSRouter("/statistic", &controllers.CycleController{}, "Post:StatisticCycleUser"),
		web.NSRouter("/templates", &controllers.CycleController{}, "Post:CycleTemplateList"),
		web.NSRouter("/template/:Id", &controllers.CycleController{}, "Get:CycleTemplate"),
	)
	web.AddNamespace(ns)
}