light modification
This commit is contained in:
parent
66196da877
commit
c63a1fef6c
@ -80,6 +80,9 @@ func (a *peerMongoAccessor) getDefaultFilter(search string) *dbs.Filters {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if search == "*" {
|
||||||
|
search = ""
|
||||||
|
}
|
||||||
return &dbs.Filters{
|
return &dbs.Filters{
|
||||||
Or: map[string][]dbs.Filter{ // search by name if no filters are provided
|
Or: map[string][]dbs.Filter{ // search by name if no filters are provided
|
||||||
"abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
"abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||||
|
@ -90,6 +90,9 @@ func (wfa *resourceMongoAccessor[T]) Search(filters *dbs.Filters, search string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (abs *resourceMongoAccessor[T]) getResourceFilter(search string) *dbs.Filters {
|
func (abs *resourceMongoAccessor[T]) getResourceFilter(search string) *dbs.Filters {
|
||||||
|
if search == "*" {
|
||||||
|
search = ""
|
||||||
|
}
|
||||||
return &dbs.Filters{
|
return &dbs.Filters{
|
||||||
Or: map[string][]dbs.Filter{ // filter by like name, short_description, description, owner, url if no filters are provided
|
Or: map[string][]dbs.Filter{ // filter by like name, short_description, description, owner, url if no filters are provided
|
||||||
"abstractintanciatedresource.abstractresource.abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
"abstractintanciatedresource.abstractresource.abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||||
|
@ -53,6 +53,7 @@ func (a *ResourceModelMongoAccessor) LoadAll(isDraft bool) ([]utils.ShallowDBObj
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *ResourceModelMongoAccessor) Search(filters *dbs.Filters, search string, isDraft bool) ([]utils.ShallowDBObject, int, error) {
|
func (a *ResourceModelMongoAccessor) Search(filters *dbs.Filters, search string, isDraft bool) ([]utils.ShallowDBObject, int, error) {
|
||||||
|
|
||||||
return utils.GenericSearch[*ResourceModel](filters, search,
|
return utils.GenericSearch[*ResourceModel](filters, search,
|
||||||
&dbs.Filters{
|
&dbs.Filters{
|
||||||
Or: map[string][]dbs.Filter{
|
Or: map[string][]dbs.Filter{
|
||||||
|
@ -88,6 +88,9 @@ func (ao *AbstractObject) VerifyAuth(request *tools.APIRequest) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ao *AbstractObject) GetObjectFilters(search string) *dbs.Filters {
|
func (ao *AbstractObject) GetObjectFilters(search string) *dbs.Filters {
|
||||||
|
if search == "*" {
|
||||||
|
search = ""
|
||||||
|
}
|
||||||
return &dbs.Filters{
|
return &dbs.Filters{
|
||||||
Or: map[string][]dbs.Filter{ // filter by name if no filters are provided
|
Or: map[string][]dbs.Filter{ // filter by name if no filters are provided
|
||||||
"abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
"abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||||
|
Loading…
Reference in New Issue
Block a user