light modification
This commit is contained in:
parent
19eb5239a6
commit
e741a95cdb
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user