correct workflow problem

This commit is contained in:
mr 2024-08-28 14:44:56 +02:00
parent ede91cde45
commit 4a3707efcf

View File

@ -26,10 +26,6 @@ func (wfa *workspaceMongoAccessor) DeleteOne(id string) (utils.DBObject, int, er
} }
func (wfa *workspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) { func (wfa *workspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
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")
}
d := set.(*Workspace) d := set.(*Workspace)
d.DataResources = nil d.DataResources = nil
d.DatacenterResources = nil d.DatacenterResources = nil
@ -51,6 +47,10 @@ func (wfa *workspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (uti
} }
func (wfa *workspaceMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) { func (wfa *workspaceMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
res, _, err := wfa.Search(nil, data.GetName())
if err == nil && len(res) > 0 {
return nil, 409, errors.New("A workspace with the same name already exists")
}
d := data.(*Workspace) d := data.(*Workspace)
d.DataResources = nil d.DataResources = nil
d.DatacenterResources = nil d.DatacenterResources = nil