simplify call to peer

This commit is contained in:
mr 2024-08-26 10:26:33 +02:00
parent 144e7f8506
commit 7c44365f52

View File

@ -2,6 +2,7 @@ package oclib
import ( import (
"errors" "errors"
"fmt"
"strings" "strings"
"cloud.o-forge.io/core/oc-lib/dbs" "cloud.o-forge.io/core/oc-lib/dbs"
@ -132,6 +133,7 @@ func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*w
func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delete bool) (int, error) { func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delete bool) (int, error) {
var err error var err error
nats := tools.NewNATSCaller() nats := tools.NewNATSCaller()
fmt.Println("EXECUTION", realData.ScheduleActive)
if !realData.ScheduleActive { if !realData.ScheduleActive {
mongo.MONGOService.DeleteMultiple(map[string]interface{}{ mongo.MONGOService.DeleteMultiple(map[string]interface{}{
"state": 1, "state": 1,
@ -176,7 +178,7 @@ func (wfa *workflowMongoAccessor) UpdateOne(set utils.DBObject, id string) (util
if code != 200 { if code != 200 {
return nil, 409, err return nil, 409, err
} }
avoid := set.(*Workflow).Schedule == nil || (res.(*Workflow).Schedule != nil && res.(*Workflow).Schedule.Start == set.(*Workflow).Schedule.Start && res.(*Workflow).Schedule.End == set.(*Workflow).Schedule.End && res.(*Workflow).Schedule.Cron == set.(*Workflow).Schedule.Cron) avoid := set.(*Workflow).Schedule == nil || (res.(*Workflow).Schedule != nil && res.(*Workflow).ScheduleActive == set.(*Workflow).ScheduleActive && res.(*Workflow).Schedule.Start == set.(*Workflow).Schedule.Start && res.(*Workflow).Schedule.End == set.(*Workflow).Schedule.End && res.(*Workflow).Schedule.Cron == set.(*Workflow).Schedule.Cron)
res, code, err = wfa.GenericUpdateOne(set, id, wfa, &Workflow{}) res, code, err = wfa.GenericUpdateOne(set, id, wfa, &Workflow{})
if code != 200 { if code != 200 {
return nil, code, err return nil, code, err