nil except

This commit is contained in:
mr 2024-08-02 11:04:18 +02:00
parent b125c9be01
commit ed4cb943a8
2 changed files with 5 additions and 3 deletions

View File

@ -103,11 +103,12 @@ func (wfa *workflowMongoAccessor) execute(workflow *Workflow) {
accessor := (&workspace.Workspace{}).GetAccessor() accessor := (&workspace.Workspace{}).GetAccessor()
filters := &dbs.Filters{ filters := &dbs.Filters{
Or: map[string]dbs.Filter{ Or: map[string]dbs.Filter{
"abstractobject.name": {Operator: dbs.LIKE.String(), Value: workflow.Name + "_workspace"}, "abstractobject.name": {dbs.LIKE.String(), workflow.Name + "_workspace"},
}, },
} }
resource, _, err := accessor.Search(filters, "") resource, _, err := accessor.Search(filters, "")
if err == nil && len(resource) == 1 { fmt.Println(resource)
if err == nil && len(resource) > 0 {
accessor.UpdateOne(&workspace.Workspace{ accessor.UpdateOne(&workspace.Workspace{
Active: true, Active: true,
ResourceSet: resources.ResourceSet{ ResourceSet: resources.ResourceSet{

View File

@ -11,6 +11,7 @@ import (
type Workspace struct { type Workspace struct {
utils.AbstractObject utils.AbstractObject
resources.ResourceSet resources.ResourceSet
IsContextual bool `json:"is_contextual" bson:"is_contextual" default:"false"`
Active bool `json:"active" bson:"active" default:"false"` Active bool `json:"active" bson:"active" default:"false"`
} }