Skip to content

Commit bb7e6e9

Browse files
committed
change filter parameter
1 parent 742598d commit bb7e6e9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

controller/item.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Loop:
276276
return
277277
}
278278

279-
result, err = item.GetAll(filter.Filter(), kind, opts)
279+
result, err = item.GetAll(filter, kind, opts)
280280
if err != nil {
281281
handleError(err, w)
282282
return

model/item/item.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ func getManyByFilter(filter interface{}, k Kind, opts *Options) (*model.Result,
116116
}
117117

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

123125
return getManyByFilter(f, k, opts)
124126
}

0 commit comments

Comments
 (0)