Skip to content

Commit

Permalink
change filter parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
morphy2k committed Jan 12, 2024
1 parent 742598d commit bb7e6e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controller/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Loop:
return
}

result, err = item.GetAll(filter.Filter(), kind, opts)
result, err = item.GetAll(filter, kind, opts)
if err != nil {
handleError(err, w)
return
Expand Down
6 changes: 4 additions & 2 deletions model/item/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ func getManyByFilter(filter interface{}, k Kind, opts *Options) (*model.Result,
}

// GetAll returns a result based on filters
func GetAll(filter bson.D, k Kind, opts *Options) (*model.Result, error) {
func GetAll(filter model.DocumentFilter, k Kind, opts *Options) (*model.Result, error) {
f := bson.D{{Key: "_kind", Value: k}}
f = append(f, filter...)
if filter != nil {
f = append(f, filter.Filter()...)
}

return getManyByFilter(f, k, opts)
}
Expand Down

0 comments on commit bb7e6e9

Please sign in to comment.