Files
mayfly-go/server/internal/flow/router/procinst.go

40 lines
982 B
Go
Raw Normal View History

package router
import (
"mayfly-go/internal/flow/api"
2024-11-20 22:43:53 +08:00
"mayfly-go/internal/flow/imsg"
"mayfly-go/pkg/biz"
"mayfly-go/pkg/ioc"
"mayfly-go/pkg/req"
"github.com/gin-gonic/gin"
)
func InitProcinstRouter(router *gin.RouterGroup) {
p := new(api.Procinst)
biz.ErrIsNil(ioc.Inject(p))
reqGroup := router.Group("/flow/procinsts")
{
reqs := [...]*req.Conf{
req.NewGet("", p.GetProcinstPage),
req.NewGet("/:id", p.GetProcinstDetail),
2024-11-20 22:43:53 +08:00
req.NewPost("/start", p.ProcinstStart).Log(req.NewLogSaveI(imsg.LogProcinstStart)),
2024-11-20 22:43:53 +08:00
req.NewPost("/:id/cancel", p.ProcinstCancel).Log(req.NewLogSaveI(imsg.LogProcinstCancel)),
req.NewGet("/tasks", p.GetTasks),
2024-11-20 22:43:53 +08:00
req.NewPost("/tasks/complete", p.CompleteTask).Log(req.NewLogSaveI(imsg.LogCompleteTask)),
2024-11-20 22:43:53 +08:00
req.NewPost("/tasks/reject", p.RejectTask).Log(req.NewLogSaveI(imsg.LogRejectTask)),
2024-11-20 22:43:53 +08:00
req.NewPost("/tasks/back", p.BackTask).Log(req.NewLogSaveI(imsg.LogBackTask)),
}
req.BatchSetGroup(reqGroup, reqs[:])
}
}