correct workflow problem

This commit is contained in:
mr
2024-08-28 13:22:43 +02:00
parent 3c5c065b8d
commit 88d2819394
2 changed files with 15 additions and 8 deletions

View File

@@ -1,6 +1,8 @@
package workspace
import (
"errors"
"cloud.o-forge.io/core/oc-lib/dbs"
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
"cloud.o-forge.io/core/oc-lib/models/resources/data"
@@ -41,6 +43,11 @@ func (wfa *workspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (uti
}
}
}
res, _, err := wfa.Search(nil, set.GetName())
if err == nil && len(res) > 0 {
return nil, 409, errors.New("A workspace with the same name already exists")
}
return wfa.GenericUpdateOne(set, id, wfa, &Workspace{})
}