Feat v0.3.2 workflow engine (#16)
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #16.
This commit is contained in:
@@ -30,6 +30,7 @@ import (
|
||||
"switchboard-core/storage"
|
||||
"switchboard-core/store"
|
||||
"switchboard-core/triggers"
|
||||
"switchboard-core/workflow"
|
||||
postgres "switchboard-core/store/postgres"
|
||||
sqliteStore "switchboard-core/store/sqlite"
|
||||
)
|
||||
@@ -399,6 +400,21 @@ func main() {
|
||||
protected.POST("/workflows/:id/publish", middleware.RequirePermission(auth.PermWorkflowCreate, stores), wfH.Publish)
|
||||
protected.GET("/workflows/:id/versions/:version", wfH.GetVersion)
|
||||
|
||||
// Workflow instances + assignments (v0.3.2)
|
||||
wfEngine := workflow.NewEngine(stores, bus, starlarkRunner)
|
||||
wfInstH := handlers.NewWorkflowInstanceHandler(wfEngine, stores)
|
||||
protected.POST("/workflows/:id/instances", middleware.RequirePermission(auth.PermWorkflowSubmit, stores), wfInstH.Start)
|
||||
protected.GET("/workflows/:id/instances", wfInstH.ListInstances)
|
||||
protected.GET("/workflows/:id/instances/:iid", wfInstH.GetInstance)
|
||||
protected.POST("/workflows/:id/instances/:iid/advance", middleware.RequirePermission(auth.PermWorkflowSubmit, stores), wfInstH.Advance)
|
||||
protected.POST("/workflows/:id/instances/:iid/cancel", middleware.RequirePermission(auth.PermWorkflowCreate, stores), wfInstH.Cancel)
|
||||
|
||||
wfAssignH := handlers.NewWorkflowAssignmentHandler(wfEngine, stores)
|
||||
protected.POST("/assignments/:id/claim", wfAssignH.Claim)
|
||||
protected.POST("/assignments/:id/unclaim", wfAssignH.Unclaim)
|
||||
protected.POST("/assignments/:id/complete", wfAssignH.Complete)
|
||||
protected.POST("/assignments/:id/cancel", middleware.RequirePermission(auth.PermWorkflowCreate, stores), wfAssignH.Cancel)
|
||||
protected.GET("/assignments/mine", wfAssignH.ListMine)
|
||||
|
||||
// Surface discovery (v0.25.0, v0.28.7: unified packages)
|
||||
pkgH := handlers.NewPackageHandler(stores)
|
||||
@@ -522,6 +538,17 @@ func main() {
|
||||
teamScoped.POST("/workflows/:id/publish", teamWfH.PublishTeamWorkflow)
|
||||
teamScoped.GET("/workflows/:id/versions/:version", teamWfH.GetTeamWorkflowVersion)
|
||||
|
||||
// Team workflow instances + assignments (v0.3.2)
|
||||
teamWfInstH := handlers.NewWorkflowInstanceHandler(wfEngine, stores)
|
||||
teamScoped.POST("/workflows/:id/instances", teamWfInstH.Start)
|
||||
teamScoped.GET("/workflows/:id/instances", teamWfInstH.ListInstances)
|
||||
teamScoped.GET("/workflows/:id/instances/:iid", teamWfInstH.GetInstance)
|
||||
teamScoped.POST("/workflows/:id/instances/:iid/advance", teamWfInstH.Advance)
|
||||
teamScoped.POST("/workflows/:id/instances/:iid/cancel", teamWfInstH.Cancel)
|
||||
|
||||
teamWfAssignH := handlers.NewWorkflowAssignmentHandler(wfEngine, stores)
|
||||
teamScoped.GET("/assignments", teamWfAssignH.ListByTeam)
|
||||
|
||||
}
|
||||
|
||||
// Public global settings (non-admin users can read safe subset)
|
||||
|
||||
Reference in New Issue
Block a user