From b775298bb0fb0eebf312a74dfa8d3e467ad4bf97 Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 23 Jul 2024 18:06:54 +0200 Subject: [PATCH] LoadAll evolve --- models/resources/data/data_mongo_accessor.go | 5 ++--- models/resources/datacenter/datacenter_mongo_accessor.go | 5 ++--- models/resources/processing/processing_mongo_accessor.go | 5 ++--- models/resources/storage/storage_mongo_accessor.go | 5 ++--- models/resources/workflow/workflow_mongo_accessor.go | 5 ++--- models/workflow/workflow_mongo_accessor.go | 4 ++-- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/models/resources/data/data_mongo_accessor.go b/models/resources/data/data_mongo_accessor.go index 58e1c3d..59f8da9 100644 --- a/models/resources/data/data_mongo_accessor.go +++ b/models/resources/data/data_mongo_accessor.go @@ -2,7 +2,6 @@ package data import ( mongo "cloud.o-forge.io/core/oc-lib/dbs/mongo" - "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/utils" ) @@ -46,9 +45,9 @@ func (wfa DataMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) { return nil, code, err } for res_mongo.Next(mongo.MngoCtx) { - var obj resources.AbstractResource + var obj DataResource res_mongo.Decode(&obj) - objs = append(objs, &obj) + objs = append(objs, &obj.AbstractResource) } return objs, 200, nil } diff --git a/models/resources/datacenter/datacenter_mongo_accessor.go b/models/resources/datacenter/datacenter_mongo_accessor.go index 6109bf6..452e542 100644 --- a/models/resources/datacenter/datacenter_mongo_accessor.go +++ b/models/resources/datacenter/datacenter_mongo_accessor.go @@ -2,7 +2,6 @@ package datacenter import ( "cloud.o-forge.io/core/oc-lib/dbs/mongo" - "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/utils" ) @@ -48,9 +47,9 @@ func (wfa DatacenterMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, erro return nil, code, err } for res_mongo.Next(mongo.MngoCtx) { - var obj resources.AbstractResource + var obj DatacenterResource res_mongo.Decode(&obj) - objs = append(objs, &obj) + objs = append(objs, &obj.AbstractResource) } return objs, 200, nil } diff --git a/models/resources/processing/processing_mongo_accessor.go b/models/resources/processing/processing_mongo_accessor.go index 5377542..9f7c44a 100644 --- a/models/resources/processing/processing_mongo_accessor.go +++ b/models/resources/processing/processing_mongo_accessor.go @@ -2,7 +2,6 @@ package processing import ( "cloud.o-forge.io/core/oc-lib/dbs/mongo" - "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/utils" ) @@ -49,9 +48,9 @@ func (wfa ProcessingMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, erro return nil, code, err } for res_mongo.Next(mongo.MngoCtx) { - var obj resources.AbstractResource + var obj ProcessingResource res_mongo.Decode(&obj) - objs = append(objs, &obj) + objs = append(objs, &obj.AbstractResource) } return objs, 200, nil } diff --git a/models/resources/storage/storage_mongo_accessor.go b/models/resources/storage/storage_mongo_accessor.go index a0777ba..a42d410 100644 --- a/models/resources/storage/storage_mongo_accessor.go +++ b/models/resources/storage/storage_mongo_accessor.go @@ -2,7 +2,6 @@ package storage import ( "cloud.o-forge.io/core/oc-lib/dbs/mongo" - "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/utils" ) @@ -49,9 +48,9 @@ func (wfa StorageMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) return nil, code, err } for res_mongo.Next(mongo.MngoCtx) { - var obj resources.AbstractResource + var obj StorageResource res_mongo.Decode(&obj) - objs = append(objs, &obj) + objs = append(objs, &obj.AbstractResource) } return objs, 200, nil } diff --git a/models/resources/workflow/workflow_mongo_accessor.go b/models/resources/workflow/workflow_mongo_accessor.go index 6181a1c..2f6c364 100644 --- a/models/resources/workflow/workflow_mongo_accessor.go +++ b/models/resources/workflow/workflow_mongo_accessor.go @@ -2,7 +2,6 @@ package oclib import ( "cloud.o-forge.io/core/oc-lib/dbs/mongo" - "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/utils" ) @@ -52,9 +51,9 @@ func (wfa WorkflowResourceMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int return nil, code, err } for res_mongo.Next(mongo.MngoCtx) { - var obj resources.AbstractResource + var obj WorkflowResource res_mongo.Decode(&obj) - objs = append(objs, &obj) + objs = append(objs, &obj.AbstractResource) } return objs, 200, nil } diff --git a/models/workflow/workflow_mongo_accessor.go b/models/workflow/workflow_mongo_accessor.go index 4cf4b43..71f3576 100644 --- a/models/workflow/workflow_mongo_accessor.go +++ b/models/workflow/workflow_mongo_accessor.go @@ -100,9 +100,9 @@ func (wfa WorkflowMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) return nil, code, err } for res_mongo.Next(mongo.MngoCtx) { - var obj utils.AbstractObject + var obj Workflow res_mongo.Decode(&obj) - objs = append(objs, &obj) + objs = append(objs, &obj.AbstractObject) } return objs, 200, nil }