Booking trace API
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
type AbstractWorkflow struct {
|
||||
resources.ResourceSet
|
||||
Graph *graph.Graph `bson:"graph,omitempty" json:"graph,omitempty"`
|
||||
ScheduleActive bool `bson:"schedule_active,omitempty" json:"schedule_active,omitempty"`
|
||||
ScheduleActive bool `json:"schedule_active,omitempty" bson:"schedule_active,omitempty"`
|
||||
Schedule *WorkflowSchedule `bson:"schedule,omitempty" json:"schedule,omitempty"`
|
||||
Shared []string `json:"shared,omitempty" bson:"shared,omitempty"`
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ func (wfa *workflowMongoAccessor) getExecutions(id string, data *Workflow) ([]*w
|
||||
|
||||
func (wfa *workflowMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
|
||||
wfa.execution(id, &Workflow{
|
||||
AbstractWorkflow: AbstractWorkflow{ScheduleActive: false},
|
||||
AbstractWorkflow: AbstractWorkflow{ScheduleActive: true},
|
||||
}, true)
|
||||
return wfa.GenericDeleteOne(id, wfa)
|
||||
}
|
||||
@@ -138,13 +138,16 @@ func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*w
|
||||
}
|
||||
|
||||
func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delete bool) (int, error) {
|
||||
if !realData.ScheduleActive {
|
||||
return 200, nil
|
||||
}
|
||||
var err error
|
||||
nats := tools.NewNATSCaller()
|
||||
res, code, _ := wfa.LoadOne(id)
|
||||
if code != 200 {
|
||||
return 404, errors.New("could not load workflow")
|
||||
}
|
||||
if (realData.Schedule == nil && !realData.ScheduleActive) || (realData.Schedule == nil && realData.ScheduleActive) {
|
||||
if realData.Schedule == nil && realData.ScheduleActive {
|
||||
mongo.MONGOService.DeleteMultiple(map[string]interface{}{
|
||||
"state": 1,
|
||||
"workflow_id": id,
|
||||
|
Reference in New Issue
Block a user