light modification
This commit is contained in:
parent
2205ac9b58
commit
1952d905d2
@ -23,7 +23,7 @@ type WorkflowExecutions 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 enum.BookingStatus `json:"state" bson:"state" default:"1"` // State is the state of the workflow
|
||||
State enum.BookingStatus `json:"state" bson:"state" default:"1"` // TEMPORARY TODO DEFAULT 1 -> 0 State is the state of the workflow
|
||||
WorkflowID string `json:"workflow_id" bson:"workflow_id,omitempty"` // WorkflowID is the ID of the workflow
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ func (wfa *workflowExecutionMongoAccessor) CopyOne(data utils.DBObject) (utils.D
|
||||
func (a *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||
return utils.GenericLoadOne[*WorkflowExecutions](id, func(d utils.DBObject) (utils.DBObject, int, error) {
|
||||
if d.(*WorkflowExecutions).State == enum.DRAFT && !a.shallow && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
|
||||
utils.GenericDeleteOne(d.GetID(), a)
|
||||
utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
|
||||
return nil, 404, errors.New("not found")
|
||||
}
|
||||
if d.(*WorkflowExecutions).State == enum.SCHEDULED && !a.shallow && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
|
||||
@ -79,7 +79,7 @@ func (a *workflowExecutionMongoAccessor) Search(filters *dbs.Filters, search str
|
||||
func (a *workflowExecutionMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
|
||||
return func(d utils.DBObject) utils.ShallowDBObject {
|
||||
if d.(*WorkflowExecutions).State == enum.DRAFT && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
|
||||
utils.GenericDeleteOne(d.GetID(), a)
|
||||
utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
|
||||
return nil
|
||||
}
|
||||
if d.(*WorkflowExecutions).State == enum.SCHEDULED && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
|
||||
|
Loading…
Reference in New Issue
Block a user