simplify call to peer

This commit is contained in:
mr 2024-08-26 15:28:51 +02:00
parent 050e6022cb
commit 63b02199f6

View File

@ -10,6 +10,7 @@ import (
w "cloud.o-forge.io/core/oc-lib/models/workflow" w "cloud.o-forge.io/core/oc-lib/models/workflow"
"cloud.o-forge.io/core/oc-lib/models/workspace" "cloud.o-forge.io/core/oc-lib/models/workspace"
"cloud.o-forge.io/core/oc-lib/models/workspace/shared/rules/rule" "cloud.o-forge.io/core/oc-lib/models/workspace/shared/rules/rule"
"cloud.o-forge.io/core/oc-lib/static"
"cloud.o-forge.io/core/oc-lib/tools" "cloud.o-forge.io/core/oc-lib/tools"
) )
@ -172,6 +173,9 @@ func (wfa *sharedWorkspaceMongoAccessor) UpdateOne(set utils.DBObject, id string
} }
func (wfa *sharedWorkspaceMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) { func (wfa *sharedWorkspaceMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
id, _ := static.GetMyLocalJsonPeer()
data.(*SharedWorkspace).CreatorID = id
data.(*SharedWorkspace).Peers = append(data.(*SharedWorkspace).Peers, id)
d, code, err := wfa.GenericStoreOne(data.(*SharedWorkspace), wfa) d, code, err := wfa.GenericStoreOne(data.(*SharedWorkspace), wfa)
if code == 200 { if code == 200 {
wfa.sharedWorkflow(d.(*SharedWorkspace), d.GetID()) wfa.sharedWorkflow(d.(*SharedWorkspace), d.GetID())