copy resource in workflow
This commit is contained in:
@@ -3,6 +3,7 @@ package storage
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/resource_model"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
)
|
||||
|
||||
@@ -12,7 +13,7 @@ type URL struct {
|
||||
}
|
||||
|
||||
type StorageResource struct {
|
||||
utils.AbstractResource
|
||||
resource_model.AbstractResource
|
||||
Acronym string `bson:"acronym,omitempty" json:"acronym,omitempty"`
|
||||
Type string `bson:"type,omitempty" json:"type,omitempty"`
|
||||
Size uint `bson:"size,omitempty" json:"size,omitempty"`
|
||||
|
||||
@@ -14,10 +14,12 @@ func (sma *StorageMongoAccessor) DeleteOne(id string) (utils.DBObject, int, erro
|
||||
}
|
||||
|
||||
func (sma *StorageMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
||||
set.(*StorageResource).ResourceModel = nil
|
||||
return sma.GenericUpdateOne(set, id, sma, &StorageResource{})
|
||||
}
|
||||
|
||||
func (sma *StorageMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||
data.(*StorageResource).ResourceModel = nil
|
||||
return sma.GenericStoreOne(data, sma)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package storage
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/resource_model"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -10,7 +11,7 @@ import (
|
||||
|
||||
func TestStoreOneStorage(t *testing.T) {
|
||||
s := StorageResource{Size: 123, Url: &URL{Protocol: "http", Path: "azerty.fr"},
|
||||
AbstractResource: utils.AbstractResource{
|
||||
AbstractResource: resource_model.AbstractResource{
|
||||
AbstractObject: utils.AbstractObject{Name: "testData"},
|
||||
Description: "Lorem Ipsum",
|
||||
Logo: "azerty.com",
|
||||
@@ -28,7 +29,7 @@ func TestStoreOneStorage(t *testing.T) {
|
||||
|
||||
func TestLoadOneStorage(t *testing.T) {
|
||||
s := StorageResource{Size: 123, Url: &URL{Protocol: "http", Path: "azerty.fr"},
|
||||
AbstractResource: utils.AbstractResource{
|
||||
AbstractResource: resource_model.AbstractResource{
|
||||
AbstractObject: utils.AbstractObject{Name: "testData"},
|
||||
Description: "Lorem Ipsum",
|
||||
Logo: "azerty.com",
|
||||
|
||||
Reference in New Issue
Block a user