workflow execution evolved
This commit is contained in:
parent
c1d0932301
commit
2f0eb9ca35
@ -21,9 +21,10 @@ import (
|
|||||||
* Booking is a struct that represents a booking
|
* Booking is a struct that represents a booking
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type Order struct {
|
type Order{} struct {
|
||||||
utils.AbstractObject
|
utils.AbstractObject
|
||||||
OrderBy string `json:"order_by" bson:"order_by" validate:"required"`
|
OrderBy string `json:"order_by" bson:"order_by" validate:"required"`
|
||||||
|
WorkflowID string `json:"workflow_id" bson:"workflow_id" validate:"required"`
|
||||||
WorkflowExecutionIDs []string `json:"workflow_execution_ids" bson:"workflow_execution_ids" validate:"required"`
|
WorkflowExecutionIDs []string `json:"workflow_execution_ids" bson:"workflow_execution_ids" validate:"required"`
|
||||||
Status enum.CompletionStatus `json:"status" bson:"status" default:"0"`
|
Status enum.CompletionStatus `json:"status" bson:"status" default:"0"`
|
||||||
SubOrders map[string]*PeerOrder `json:"sub_orders" bson:"sub_orders"`
|
SubOrders map[string]*PeerOrder `json:"sub_orders" bson:"sub_orders"`
|
||||||
@ -91,10 +92,11 @@ func (o *Order) draftStoreFromModel(scheduler *workflow_execution.WorkflowSchedu
|
|||||||
return errors.New("no request found")
|
return errors.New("no request found")
|
||||||
}
|
}
|
||||||
fmt.Println("Drafting order", scheduler.Workflow)
|
fmt.Println("Drafting order", scheduler.Workflow)
|
||||||
if scheduler.Workflow == nil || scheduler.Workflow.Graph == nil { // if the workflow has no graph, return an error
|
if scheduler.Workflow == nil || scheduler.Workflow.Graph == nil { // if the workflow has no graph, return an error
|
||||||
return errors.New("no graph found")
|
return errors.New("no graph found")
|
||||||
}
|
}
|
||||||
o.SetName()
|
o.SetName()
|
||||||
|
o.WorkflowID = scheduler.Workflow.GetID()
|
||||||
o.IsDraft = true
|
o.IsDraft = true
|
||||||
o.OrderBy = request.Username
|
o.OrderBy = request.Username
|
||||||
o.WorkflowExecutionIDs = []string{} // create an array of ids
|
o.WorkflowExecutionIDs = []string{} // create an array of ids
|
||||||
@ -138,6 +140,7 @@ func (o *Order) draftStoreFromModel(scheduler *workflow_execution.WorkflowSchedu
|
|||||||
// should store the order
|
// should store the order
|
||||||
res, code, err := o.GetAccessor(request).Search(&dbs.Filters{
|
res, code, err := o.GetAccessor(request).Search(&dbs.Filters{
|
||||||
And: map[string][]dbs.Filter{
|
And: map[string][]dbs.Filter{
|
||||||
|
"workflow_id": {{Operator: dbs.EQUAL.String(), Value: o.WorkflowID}},
|
||||||
"order_by": {{Operator: dbs.EQUAL.String(), Value: request.Username}},
|
"order_by": {{Operator: dbs.EQUAL.String(), Value: request.Username}},
|
||||||
},
|
},
|
||||||
}, "", o.IsDraft)
|
}, "", o.IsDraft)
|
||||||
|
Loading…
Reference in New Issue
Block a user