This commit is contained in:
mr
2024-11-28 13:19:01 +01:00
parent b388e43f30
commit 9ea342c4c4
37 changed files with 198 additions and 122 deletions

View File

@@ -16,7 +16,5 @@ type Workspace struct {
}
func (d *Workspace) GetAccessor(peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
data := New(peerID, groups) // Create a new instance of the accessor
data.Init(tools.WORKSPACE, peerID, groups, caller) // Initialize the accessor with the WORKSPACE model type
return data
return New(tools.WORKSPACE, peerID, groups, caller) // Create a new instance of the accessor
}

View File

@@ -9,9 +9,7 @@ import (
type WorkspaceHistory struct{ Workspace }
func (d *WorkspaceHistory) GetAccessor(peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
data := New(peerID, groups) // Create a new instance of the accessor
data.Init(tools.WORKSPACE_HISTORY, peerID, groups, caller) // Initialize the accessor with the WORKSPACE model type
return data
return New(tools.WORKFLOW_HISTORY, peerID, groups, caller) // Create a new instance of the accessor
}
func (r *WorkspaceHistory) GenerateID() {
r.UUID = uuid.New().String()

View File

@@ -6,6 +6,7 @@ import (
"cloud.o-forge.io/core/oc-lib/dbs"
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
"cloud.o-forge.io/core/oc-lib/logs"
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/shallow_collaborative_area"
"cloud.o-forge.io/core/oc-lib/models/peer"
"cloud.o-forge.io/core/oc-lib/models/utils"
@@ -18,8 +19,16 @@ type workspaceMongoAccessor struct {
}
// New creates a new instance of the workspaceMongoAccessor
func New(peerID string, groups []string) *workspaceMongoAccessor {
return &workspaceMongoAccessor{}
func New(t tools.DataType, peerID string, groups []string, caller *tools.HTTPCaller) *workspaceMongoAccessor {
return &workspaceMongoAccessor{
utils.AbstractAccessor{
Logger: logs.CreateLogger(t.String()), // Create a logger with the data type
Caller: caller,
PeerID: peerID,
Groups: groups, // Set the caller
Type: t.String(),
},
}
}
// DeleteOne deletes a workspace from the database, given its ID, it automatically share to peers if the workspace is shared