evaluation_project_router.go 1.5 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-project",
		web.NSBefore(filters.AllowCors(), middlewares.CheckAdminToken()),
		web.NSRouter("/", &controllers.ProjectController{}, "Post:CreateProject"),
		web.NSRouter("/", &controllers.ProjectController{}, "Put:UpdateProject"),
		web.NSRouter("/", &controllers.ProjectController{}, "Delete:RemoveProject"),
		web.NSRouter("/:Id", &controllers.ProjectController{}, "Get:GetProject"),
		web.NSRouter("/list", &controllers.ProjectController{}, "Post:ListProject"),
		web.NSRouter("/detail", &controllers.ProjectController{}, "Put:UpdateProjectForTemplate"),
		web.NSRouter("/check-recipients", &controllers.ProjectController{}, "Post:CheckRecipients"),
		web.NSRouter("/check-template", &controllers.ProjectController{}, "Post:CheckTaskTemplate"),
		web.NSRouter("/copy", &controllers.ProjectController{}, "Post:CopyProject"),
		web.NSRouter("/activate", &controllers.ProjectController{}, "Post:ActivateProject"),
		web.NSRouter("/pause", &controllers.ProjectController{}, "Post:PauseProject"),
		web.NSRouter("/resume", &controllers.ProjectController{}, "Post:ResumeProject"),
		web.NSCtrlGet("/fix/evaluation_item_used", (*controllers.ProjectController).FixEvaluationItemUsed),
	)

	web.AddNamespace(ns)
}