From 4a3707efcf3b7748f208144679de9002e1ffe4cc Mon Sep 17 00:00:00 2001 From: mr Date: Wed, 28 Aug 2024 14:44:56 +0200 Subject: [PATCH] correct workflow problem --- models/workspace/workspace_mongo_accessor.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/workspace/workspace_mongo_accessor.go b/models/workspace/workspace_mongo_accessor.go index 9d6f744..4a5fbbe 100644 --- a/models/workspace/workspace_mongo_accessor.go +++ b/models/workspace/workspace_mongo_accessor.go @@ -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) { - 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.DataResources = 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) { + 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.DataResources = nil d.DatacenterResources = nil