light modification
This commit is contained in:
		@@ -23,7 +23,7 @@ type WorkflowExecutions struct {
 | 
				
			|||||||
	utils.AbstractObject                    // AbstractObject contains the basic fields of an object (id, name)
 | 
						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
 | 
						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
 | 
						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"`                                               // State is the state of the workflow
 | 
						State                enum.BookingStatus `json:"state" bson:"state" default:"1"`                                               // State is the state of the workflow
 | 
				
			||||||
	WorkflowID           string             `json:"workflow_id" bson:"workflow_id,omitempty"`                                     // WorkflowID is the ID of the workflow
 | 
						WorkflowID           string             `json:"workflow_id" bson:"workflow_id,omitempty"`                                     // WorkflowID is the ID of the workflow
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,6 @@ package workflow_execution
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
	"fmt"
 | 
					 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"cloud.o-forge.io/core/oc-lib/dbs"
 | 
						"cloud.o-forge.io/core/oc-lib/dbs"
 | 
				
			||||||
@@ -58,7 +57,7 @@ func (wfa *workflowExecutionMongoAccessor) CopyOne(data utils.DBObject) (utils.D
 | 
				
			|||||||
func (a *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
 | 
					func (a *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
 | 
				
			||||||
	return utils.GenericLoadOne[*WorkflowExecutions](id, func(d utils.DBObject) (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) {
 | 
							if d.(*WorkflowExecutions).State == enum.DRAFT && !a.shallow && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
 | 
				
			||||||
			utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
 | 
								utils.GenericDeleteOne(d.GetID(), a)
 | 
				
			||||||
			return nil, 404, errors.New("not found")
 | 
								return nil, 404, errors.New("not found")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if d.(*WorkflowExecutions).State == enum.SCHEDULED && !a.shallow && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
 | 
							if d.(*WorkflowExecutions).State == enum.SCHEDULED && !a.shallow && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
 | 
				
			||||||
@@ -79,9 +78,8 @@ func (a *workflowExecutionMongoAccessor) Search(filters *dbs.Filters, search str
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func (a *workflowExecutionMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
 | 
					func (a *workflowExecutionMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
 | 
				
			||||||
	return func(d utils.DBObject) utils.ShallowDBObject {
 | 
						return func(d utils.DBObject) utils.ShallowDBObject {
 | 
				
			||||||
		fmt.Println("getExec", d)
 | 
					 | 
				
			||||||
		if d.(*WorkflowExecutions).State == enum.DRAFT && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
 | 
							if d.(*WorkflowExecutions).State == enum.DRAFT && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
 | 
				
			||||||
			utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
 | 
								utils.GenericDeleteOne(d.GetID(), a)
 | 
				
			||||||
			return nil
 | 
								return nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if d.(*WorkflowExecutions).State == enum.SCHEDULED && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
 | 
							if d.(*WorkflowExecutions).State == enum.SCHEDULED && time.Now().UTC().After(d.(*WorkflowExecutions).ExecDate) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user