Skip to content

Commit

Permalink
Make sure ids in queries are respected (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeper[bot] authored and daffl committed Jan 13, 2019
1 parent e7f04f3 commit 4fac435
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class Service extends AdapterService {
return this._find(findParams);
}

findParams.query[this.id] = id;
findParams.query.$and = (findParams.query.$and || []).concat({ [this.id]: id });

return this._find(findParams);
}
Expand Down
24 changes: 20 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@
"lib": "lib"
},
"dependencies": {
"@feathersjs/adapter-commons": "^1.0.6",
"@feathersjs/adapter-commons": "^2.0.0",
"@feathersjs/commons": "^4.0.0",
"@feathersjs/errors": "^3.3.5",
"debug": "^4.1.0",
"is-plain-object": "^2.0.4"
},
"devDependencies": {
"@feathersjs/adapter-tests": "^1.0.1",
"@feathersjs/express": "^1.3.0",
"@feathersjs/feathers": "^3.3.0",
"body-parser": "^1.18.3",
Expand Down
8 changes: 6 additions & 2 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const chaiAsPromised = require('chai-as-promised');
const feathers = require('@feathersjs/feathers');
const knex = require('knex');

const adapterTests = require('@feathersjs/adapter-commons/tests');
const adapterTests = require('@feathersjs/adapter-tests');
const errors = require('@feathersjs/errors');

const service = require('../lib');
Expand Down Expand Up @@ -65,7 +65,11 @@ const testSuite = adapterTests([
'.find + paginate',
'.find + paginate + $limit + $skip',
'.find + paginate + $limit 0',
'.find + paginate + params'
'.find + paginate + params',
'.get + id + query id',
'.remove + id + query id',
'.update + id + query id',
'.patch + id + query id'
]);

chai.use(chaiAsPromised);
Expand Down

0 comments on commit 4fac435

Please sign in to comment.