diff --git a/models/order/order.go b/models/order/order.go index 833090a..81ce701 100644 --- a/models/order/order.go +++ b/models/order/order.go @@ -21,7 +21,7 @@ import ( * Booking is a struct that represents a booking */ -type Order{} struct { +type Order struct { utils.AbstractObject OrderBy string `json:"order_by" bson:"order_by" validate:"required"` WorkflowID string `json:"workflow_id" bson:"workflow_id" validate:"required"` @@ -98,7 +98,7 @@ func (o *Order) draftStoreFromModel(scheduler *workflow_execution.WorkflowSchedu o.SetName() o.WorkflowID = scheduler.Workflow.GetID() o.IsDraft = true - o.OrderBy = request.Username + o.OrderBy = request.PeerID o.WorkflowExecutionIDs = []string{} // create an array of ids for _, exec := range scheduler.WorkflowExecutions { o.WorkflowExecutionIDs = append(o.WorkflowExecutionIDs, exec.GetID()) @@ -141,7 +141,7 @@ func (o *Order) draftStoreFromModel(scheduler *workflow_execution.WorkflowSchedu res, code, err := o.GetAccessor(request).Search(&dbs.Filters{ 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.PeerID}}, }, }, "", o.IsDraft) if code != 200 || err != nil {