diff --git a/models/resources/resource_accessor.go b/models/resources/resource_accessor.go index 421ce34..9868f5a 100644 --- a/models/resources/resource_accessor.go +++ b/models/resources/resource_accessor.go @@ -2,6 +2,7 @@ package resources import ( "slices" + "strings" "cloud.o-forge.io/core/oc-lib/dbs" "cloud.o-forge.io/core/oc-lib/logs" @@ -70,9 +71,6 @@ func (wfa *resourceMongoAccessor[T]) LoadAll(isDraft bool) ([]utils.ShallowDBObj resources, _, err := wfa.ResourceModelAccessor.Search(nil, wfa.GetType().String(), isDraft) return utils.GenericLoadAll[T](func(d utils.DBObject) utils.ShallowDBObject { d.(T).SetAllowedInstances(wfa.Request) - if d.(T).GetType() != wfa.GetType().String() { - return nil - } if err == nil && len(resources) > 0 { d.(T).SetResourceModel(resources[0].(*resource_model.ResourceModel)) } @@ -85,7 +83,7 @@ func (wfa *resourceMongoAccessor[T]) Search(filters *dbs.Filters, search string, return utils.GenericSearch[T](filters, search, wfa.getResourceFilter(search), func(d utils.DBObject) utils.ShallowDBObject { d.(T).SetAllowedInstances(wfa.Request) - if d.(T).GetType() != wfa.GetType().String() { + if strings.Contains(d.(T).GetType(), search) && search != "" { return nil } if err == nil && len(resources) > 0 {