oclib update + controller

This commit is contained in:
mr
2025-02-18 15:01:10 +01:00
parent e808556906
commit df4e6fcc5c
3 changed files with 22 additions and 6 deletions

View File

@@ -2,7 +2,6 @@ package controllers
import (
"encoding/json"
"fmt"
oclib "cloud.o-forge.io/core/oc-lib"
"cloud.o-forge.io/core/oc-lib/dbs"
@@ -44,10 +43,11 @@ func (o *WorkflowSchedulerController) Schedule() {
req := oclib.NewRequest(collection, user, peerID, groups, caller)
resp.UUID = uuid.New().String()
sch, err := req.Schedule(id, resp)
fmt.Println("SCHEDULE", sch, err)
if err != nil {
for _, w := range sch.WorkflowExecution {
req.DeleteOne(w.GetID())
if sch != nil {
for _, w := range sch.WorkflowExecution {
req.DeleteOne(w.GetID())
}
}
o.Data["json"] = map[string]interface{}{
"data": nil,
@@ -58,7 +58,7 @@ func (o *WorkflowSchedulerController) Schedule() {
return
}
o.Data["json"] = map[string]interface{}{
"data": sch,
"data": sch.WorkflowExecution,
"code": code,
"error": e,
}