diff --git a/models/workflow_execution/workflow_execution.go b/models/workflow_execution/workflow_execution.go index b4be771..b801773 100644 --- a/models/workflow_execution/workflow_execution.go +++ b/models/workflow_execution/workflow_execution.go @@ -83,7 +83,7 @@ type WorkflowExecution struct { utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name) 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 int64 `json:"state,omitempty" bson:"state,omitempty"` // State is the state of the workflow + State int64 `json:"state" bson:"state" default:"0"` // State is the state of the workflow WorkflowID string `json:"workflow_id" bson:"workflow_id,omitempty"` // WorkflowID is the ID of the workflow } diff --git a/models/workflow_execution/workflow_execution_mongo_accessor.go b/models/workflow_execution/workflow_execution_mongo_accessor.go index 3a78ade..6ad56d6 100644 --- a/models/workflow_execution/workflow_execution_mongo_accessor.go +++ b/models/workflow_execution/workflow_execution_mongo_accessor.go @@ -1,6 +1,7 @@ package workflow_execution import ( + "fmt" "time" "cloud.o-forge.io/core/oc-lib/dbs" @@ -40,6 +41,7 @@ func (wfa *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, i return nil, code, err } res_mongo.Decode(&workflow) + fmt.Println("workflow: ", workflow.State, time.Now().UTC().After(*workflow.ExecDate)) if workflow.State == int64(SCHEDULED) && time.Now().UTC().After(*workflow.ExecDate) { workflow.State = int64(FORGOTTEN) wfa.UpdateOne(&workflow, id)