diff --git a/models/workflow_execution/workflow_execution.go b/models/workflow_execution/workflow_execution.go index 227fc32..9ebc93e 100644 --- a/models/workflow_execution/workflow_execution.go +++ b/models/workflow_execution/workflow_execution.go @@ -21,7 +21,7 @@ import ( */ type WorkflowExecution struct { utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name) - ExecutionID string `json:"execution_id,omitempty" bson:"execution_id,omitempty" validate:"required"` + ExecutionsID string `json:"executions_id,omitempty" bson:"executions_id,omitempty" validate:"required"` ExecDate time.Time `json:"execution_date,omitempty" bson:"execution_date,omitempty" validate:"required"` // ExecDate is the execution date of the workflow, is required EndDate *time.Time `json:"end_date,omitempty" bson:"end_date,omitempty"` // EndDate is the end date of the workflow State enum.BookingStatus `json:"state" bson:"state" default:"0"` // TEMPORARY TODO DEFAULT 1 -> 0 State is the state of the workflow diff --git a/models/workflow_execution/workflow_scheduler.go b/models/workflow_execution/workflow_scheduler.go index 7889a44..01cf461 100644 --- a/models/workflow_execution/workflow_scheduler.go +++ b/models/workflow_execution/workflow_scheduler.go @@ -121,7 +121,6 @@ func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (* if err != nil { return ws, nil, []*WorkflowExecution{}, errors.New("purge draft" + fmt.Sprintf("%v", err)) } - exec.GenerateID() exec.StoreDraftDefault() // Should DELETE the previous execution2 utils.GenericStoreOne(exec, NewAccessor(request)) @@ -153,10 +152,11 @@ func (ws *WorkflowSchedule) getExecutions(workflow *workflow.Workflow) ([]*Workf UUID: uuid.New().String(), // set the uuid of the execution Name: workflow.Name + "_execution_" + date.Start.String(), // set the name of the execution }, - ExecDate: date.Start, // set the execution date - EndDate: date.End, // set the end date - State: enum.DRAFT, // set the state to 1 (scheduled) - WorkflowID: workflow.GetID(), // set the workflow id dependancy of the execution + ExecutionsID: ws.UUID, + ExecDate: date.Start, // set the execution date + EndDate: date.End, // set the end date + State: enum.DRAFT, // set the state to 1 (scheduled) + WorkflowID: workflow.GetID(), // set the workflow id dependancy of the execution } workflows_executions = append(workflows_executions, obj) }