Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# feathers-sequelize

[![CI](https://github.com/feathersjs-ecosystem/feathers-sequelize/workflows/CI/badge.svg)](https://github.com/feathersjs-ecosystem/feathers-sequelize/actions?query=workflow%3ACI)
[![Dependency Status](https://img.shields.io/david/feathersjs-ecosystem/feathers-sequelize.svg?style=flat-square)](https://david-dm.org/feathersjs-ecosystem/feathers-sequelize)
[![Download Status](https://img.shields.io/npm/dm/feathers-sequelize.svg?style=flat-square)](https://www.npmjs.com/package/feathers-sequelize)

A [Feathers](https://feathersjs.com) database adapter for [Sequelize](http://sequelizejs.com), an ORM for Node.js. It supports PostgreSQL, MySQL, MariaDB, SQLite and MSSQL and features transaction support, relations, read replication and more.
Expand All @@ -21,6 +20,7 @@ A [Feathers](https://feathersjs.com) database adapter for [Sequelize](http://seq
- [Embrace the ORM](#embrace-the-orm)
- [Setting `params.sequelize.include`](#setting-paramssequelizeinclude)
- [Querying](#querying)
- [Querying a nested column](#querying-a-nested-column)
- [Working with Sequelize Model instances](#working-with-sequelize-model-instances)
- [Validation](#validation)
- [Testing sequelize queries in isolation](#testing-sequelize-queries-in-isolation)
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Service extends AdapterService {
return converted;
};

filtered.query = convertOperators(filtered.query);
filtered.query = Object.assign({}, convertOperators(filtered.query));

return filtered;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ exports.errorHandler = error => {
exports.getOrder = (sort = {}) => Object.keys(sort).reduce((order, name) => {
let direction;
if (Array.isArray(sort[name])) {
direction = parseInt(sort[name][0], 10) === 1 ? 'ASC' : 'DESC';
direction += parseInt(sort[name][1], 10) === 1 ? ' NULLS FIRST': ' NULLS LAST';
direction = parseInt(sort[name][0], 10) === 1 ? 'ASC' : 'DESC';
direction += parseInt(sort[name][1], 10) === 1 ? ' NULLS FIRST' : ' NULLS LAST';
} else {
direction = parseInt(sort[name], 10) === 1 ? 'ASC' : 'DESC';
}
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

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

11 changes: 11 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,17 @@ describe('Feathers Sequelize Service', () => {
await people.remove(person.id);
});

it('cleans up the query prototype', async () => {
const page = await people.find({
query: {
name: 'Dave',
__proto__: []
}
});

assert.strictEqual(page.data.length, 0);
});

it('still allows querying with Sequelize operators', async () => {
const name = 'Age test';
const person = await people.create({ name, age: 10 });
Expand Down