diff --git a/package.json b/package.json index e9dedfe..b454e00 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ }, "dependencies": { "feathers-errors": "^2.0.1", - "feathers-query-filters": "^1.5.1", + "feathers-query-filters": "^2.0.0", "lodash.omit": "^4.3.0", "uberproto": "^1.1.2" }, diff --git a/src/index.js b/src/index.js index ae4c177..1bbda50 100644 --- a/src/index.js +++ b/src/index.js @@ -24,17 +24,18 @@ class Service { } _find(params, getFilter = filter) { - let where = utils.getWhere(params.query); - let filters = getFilter(where); - let order = utils.getOrder(filters.$sort); - let query = Object.assign({ + const { filters, query } = getFilter(params.query || {}); + const where = utils.getWhere(query); + const order = utils.getOrder(filters.$sort); + + const q = Object.assign({ where, order, limit: filters.$limit, offset: filters.$skip, attributes: filters.$select || null }, params.sequelize); - return this.Model.findAndCount(query).then(result => { + return this.Model.findAndCount(q).then(result => { return { total: result.count, limit: filters.$limit,