some
This commit is contained in:
@@ -14,7 +14,5 @@ type WorkflowResource struct {
|
||||
}
|
||||
|
||||
func (d *WorkflowResource) GetAccessor(peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
|
||||
data := New() // Create a new instance of the accessor
|
||||
data.Init(tools.WORKFLOW_RESOURCE, peerID, groups, caller) // Initialize the accessor with the WORKFLOW_RESOURCE model type
|
||||
return data
|
||||
return New(tools.WORKFLOW_RESOURCE, peerID, groups, caller) // Create a new instance of the accessor
|
||||
}
|
||||
|
||||
@@ -5,18 +5,25 @@ 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/resources/resource_model"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
)
|
||||
|
||||
type workflowResourceMongoAccessor struct {
|
||||
utils.AbstractAccessor // AbstractAccessor contains the basic fields of an accessor (model, caller)
|
||||
}
|
||||
|
||||
func New() *workflowResourceMongoAccessor {
|
||||
func New(t tools.DataType, peerID string, groups []string, caller *tools.HTTPCaller) *workflowResourceMongoAccessor {
|
||||
return &workflowResourceMongoAccessor{
|
||||
utils.AbstractAccessor{
|
||||
ResourceModelAccessor: resource_model.New(),
|
||||
Logger: logs.CreateLogger(t.String()), // Create a logger with the data type
|
||||
Caller: caller,
|
||||
PeerID: peerID,
|
||||
Groups: groups, // Set the caller
|
||||
Type: t.String(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/resource_model"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -20,7 +21,7 @@ func TestStoreOneWorkflow(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
wma := New()
|
||||
wma := New(tools.WORKFLOW_RESOURCE, "peerID", []string{}, nil)
|
||||
id, _, _ := wma.StoreOne(&w)
|
||||
|
||||
assert.NotEmpty(t, id)
|
||||
@@ -37,7 +38,7 @@ func TestLoadOneWorkflow(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
wma := New()
|
||||
wma := New(tools.WORKFLOW_RESOURCE, "peerID", []string{}, nil)
|
||||
new_w, _, _ := wma.StoreOne(&w)
|
||||
assert.Equal(t, w, new_w)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user