From 71624063af53002ca6ef4db0ebf83136de705994 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Sun, 10 Jul 2016 03:48:37 +0200 Subject: [PATCH] =?UTF-8?q?Update=20feathers-query-filters=20to=20version?= =?UTF-8?q?=202.0.0=20=F0=9F=9A=80=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(package): update feathers-query-filters to version 2.0.0 * Update feathers-query-filters usage --- package.json | 2 +- src/index.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) 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,