workflow scheduler create booking with a booking execution lot id

This commit is contained in:
mr 2025-02-11 15:33:01 +01:00
parent 7d03676ac2
commit a098b3797a
2 changed files with 6 additions and 6 deletions

View File

@ -21,7 +21,7 @@ import (
*/ */
type WorkflowExecution struct { type WorkflowExecution 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)
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 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"` // TEMPORARY TODO DEFAULT 1 -> 0 State is the state of the workflow State enum.BookingStatus `json:"state" bson:"state" default:"0"` // TEMPORARY TODO DEFAULT 1 -> 0 State is the state of the workflow

View File

@ -121,7 +121,6 @@ func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (*
if err != nil { if err != nil {
return ws, nil, []*WorkflowExecution{}, errors.New("purge draft" + fmt.Sprintf("%v", err)) return ws, nil, []*WorkflowExecution{}, errors.New("purge draft" + fmt.Sprintf("%v", err))
} }
exec.GenerateID()
exec.StoreDraftDefault() exec.StoreDraftDefault()
// Should DELETE the previous execution2 // Should DELETE the previous execution2
utils.GenericStoreOne(exec, NewAccessor(request)) 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 UUID: uuid.New().String(), // set the uuid of the execution
Name: workflow.Name + "_execution_" + date.Start.String(), // set the name of the execution Name: workflow.Name + "_execution_" + date.Start.String(), // set the name of the execution
}, },
ExecDate: date.Start, // set the execution date ExecutionsID: ws.UUID,
EndDate: date.End, // set the end date ExecDate: date.Start, // set the execution date
State: enum.DRAFT, // set the state to 1 (scheduled) EndDate: date.End, // set the end date
WorkflowID: workflow.GetID(), // set the workflow id dependancy of the execution 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) workflows_executions = append(workflows_executions, obj)
} }