workflow execution evolved
This commit is contained in:
@@ -87,21 +87,21 @@ func (ws *WorkflowSchedule) CheckBooking(wfID string, request *tools.APIRequest)
|
||||
return true, wf, execs, nil
|
||||
}
|
||||
|
||||
func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (*workflow.Workflow, []*WorkflowExecutions, error) {
|
||||
func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (*WorkflowSchedule, *workflow.Workflow, []*WorkflowExecutions, error) {
|
||||
if request == nil {
|
||||
return nil, []*WorkflowExecutions{}, errors.New("no request found")
|
||||
return ws, nil, []*WorkflowExecutions{}, errors.New("no request found")
|
||||
}
|
||||
c := request.Caller
|
||||
if c == nil || c.URLS == nil || c.URLS[tools.BOOKING] == nil {
|
||||
return nil, []*WorkflowExecutions{}, errors.New("no caller defined")
|
||||
return ws, nil, []*WorkflowExecutions{}, errors.New("no caller defined")
|
||||
}
|
||||
methods := c.URLS[tools.BOOKING]
|
||||
if _, ok := methods[tools.GET]; !ok {
|
||||
return nil, []*WorkflowExecutions{}, errors.New("no path found")
|
||||
return ws, nil, []*WorkflowExecutions{}, errors.New("no path found")
|
||||
}
|
||||
ok, wf, executions, err := ws.CheckBooking(wfID, request)
|
||||
if !ok || err != nil {
|
||||
return nil, []*WorkflowExecutions{}, errors.New("could not book the workflow : " + fmt.Sprintf("%v", err))
|
||||
return ws, nil, []*WorkflowExecutions{}, errors.New("could not book the workflow : " + fmt.Sprintf("%v", err))
|
||||
}
|
||||
|
||||
ws.Workflow = wf
|
||||
@@ -110,14 +110,14 @@ func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (*
|
||||
for _, exec := range executions {
|
||||
err := exec.PurgeDraft(request)
|
||||
if err != nil {
|
||||
return nil, []*WorkflowExecutions{}, errors.New("purge draft" + fmt.Sprintf("%v", err))
|
||||
return ws, nil, []*WorkflowExecutions{}, errors.New("purge draft" + fmt.Sprintf("%v", err))
|
||||
}
|
||||
exec.GenerateID()
|
||||
exec.StoreDraftDefault()
|
||||
// Should DELETE the previous execution2
|
||||
utils.GenericStoreOne(exec, NewAccessor(request))
|
||||
}
|
||||
return wf, executions, nil
|
||||
return ws, wf, executions, nil
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user