feathers-sequelize
Advanced tools
Comparing version 2.3.2 to 2.4.0
# Change Log | ||
## [v2.3.2](https://github.com/feathersjs/feathers-sequelize/tree/v2.3.2) (2017-10-14) | ||
[Full Changelog](https://github.com/feathersjs/feathers-sequelize/compare/v2.3.1...v2.3.2) | ||
**Closed issues:** | ||
- The patch on postgres is selecting every row from the table before updating [\#168](https://github.com/feathersjs/feathers-sequelize/issues/168) | ||
- Can't override id field when declaring a \(MySQL\) service [\#164](https://github.com/feathersjs/feathers-sequelize/issues/164) | ||
- Run tests against all sequelize dialects [\#163](https://github.com/feathersjs/feathers-sequelize/issues/163) | ||
- Adding model includes returns incorrect paging count [\#161](https://github.com/feathersjs/feathers-sequelize/issues/161) | ||
- Raw associations prevent pagination total being available [\#137](https://github.com/feathersjs/feathers-sequelize/issues/137) | ||
- update not working? [\#125](https://github.com/feathersjs/feathers-sequelize/issues/125) | ||
**Merged pull requests:** | ||
- Fixed the patch method to not fetch all rows [\#169](https://github.com/feathersjs/feathers-sequelize/pull/169) ([andymoon](https://github.com/andymoon)) | ||
- Update mocha to the latest version 🚀 [\#167](https://github.com/feathersjs/feathers-sequelize/pull/167) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) | ||
- Slightly better class for extending. [\#166](https://github.com/feathersjs/feathers-sequelize/pull/166) ([devel-pa](https://github.com/devel-pa)) | ||
## [v2.3.1](https://github.com/feathersjs/feathers-sequelize/tree/v2.3.1) (2017-09-06) | ||
@@ -4,0 +22,0 @@ [Full Changelog](https://github.com/feathersjs/feathers-sequelize/compare/v2.3.0...v2.3.1) |
@@ -84,2 +84,3 @@ 'use strict'; | ||
var getFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _feathersQueryFilters2.default; | ||
var paginate = arguments[2]; | ||
@@ -120,10 +121,18 @@ var _getFilter = getFilter(params.query || {}), | ||
return Model.findAndCount(q).then(function (result) { | ||
return { | ||
total: result.count, | ||
limit: filters.$limit, | ||
skip: filters.$skip || 0, | ||
data: result.rows | ||
}; | ||
}).catch(utils.errorHandler); | ||
if (paginate) { | ||
return Model.findAndCountAll(q).then(function (result) { | ||
return { | ||
total: result.count, | ||
limit: filters.$limit, | ||
skip: filters.$skip || 0, | ||
data: result.rows | ||
}; | ||
}).catch(utils.errorHandler); | ||
} else { | ||
return Model.findAll(q).then(function (result) { | ||
return { | ||
data: result | ||
}; | ||
}).catch(utils.errorHandler); | ||
} | ||
} | ||
@@ -136,3 +145,3 @@ }, { | ||
return (0, _feathersQueryFilters2.default)(where, paginate); | ||
}); | ||
}, paginate); | ||
@@ -249,3 +258,3 @@ if (!paginate.default) { | ||
// This is the best way to implement patch in sql, the other dialects 'should' use a transaction. | ||
if (Model.sequelize.options.dialect === 'postgres') { | ||
if (Model.sequelize.options.dialect === 'postgres' && params.$returning !== false) { | ||
options.returning = true; | ||
@@ -281,3 +290,7 @@ | ||
return Model.update((0, _lodash2.default)(data, _this2.id), options).then(function () { | ||
return _this2._getOrFind(id, findParams); | ||
if (params.$returning !== false) { | ||
return _this2._getOrFind(id, findParams); | ||
} else { | ||
return Promise.resolve([]); | ||
} | ||
}); | ||
@@ -322,20 +335,24 @@ }).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler); | ||
value: function remove(id, params) { | ||
var _this4 = this; | ||
var opts = _extends({ raw: this.raw }, params); | ||
return this._getOrFind(id, opts).then(function (data) { | ||
var where = _extends({}, (0, _feathersQueryFilters2.default)(params.query || {}).query); | ||
var where = _extends({}, (0, _feathersQueryFilters2.default)(params.query || {}).query); | ||
if (id !== null) { | ||
where[_this4.id] = id; | ||
} | ||
if (id !== null) { | ||
where[this.id] = id; | ||
} | ||
var options = _extends({}, params.sequelize, { where: where }); | ||
var options = _extends({}, params.sequelize, { where: where }); | ||
var Model = _this4.applyScope(params); | ||
var Model = this.applyScope(params); | ||
if (params.$returning !== false) { | ||
return this._getOrFind(id, opts).then(function (data) { | ||
return Model.destroy(options).then(function () { | ||
return data; | ||
}); | ||
}).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler); | ||
} else { | ||
return Model.destroy(options).then(function () { | ||
return data; | ||
}); | ||
}).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler); | ||
return Promise.resolve([]); | ||
}).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler); | ||
} | ||
} | ||
@@ -342,0 +359,0 @@ }]); |
{ | ||
"name": "feathers-sequelize", | ||
"description": "A service adapter for Sequelize an SQL ORM", | ||
"version": "2.3.2", | ||
"homepage": "https://github.com/feathersjs/feathers-sequelize", | ||
"version": "2.4.0", | ||
"homepage": "https://github.com/feathersjs-ecosystem/feathers-sequelize", | ||
"main": "lib/", | ||
@@ -22,3 +22,3 @@ "keywords": [ | ||
"type": "git", | ||
"url": "git://github.com/feathersjs/feathers-sequelize.git" | ||
"url": "git://github.com/feathersjs-ecosystem/feathers-sequelize.git" | ||
}, | ||
@@ -32,3 +32,3 @@ "author": { | ||
"bugs": { | ||
"url": "https://github.com/feathersjs/feathers-sequelize/issues" | ||
"url": "https://github.com/feathersjs-ecosystem/feathers-sequelize/issues" | ||
}, | ||
@@ -35,0 +35,0 @@ "engines": { |
# feathers-sequelize | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/feathersjs/feathers-sequelize.svg)](https://greenkeeper.io/) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/feathersjs-ecosystem/feathers-sequelize.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/feathersjs/feathers-sequelize.png?branch=master)](https://travis-ci.org/feathersjs/feathers-sequelize) | ||
[![Code Climate](https://codeclimate.com/github/feathersjs/feathers-sequelize.png)](https://codeclimate.com/github/feathersjs/feathers-sequelize) | ||
[![Test Coverage](https://codeclimate.com/github/feathersjs/feathers-sequelize/badges/coverage.svg)](https://codeclimate.com/github/feathersjs/feathers-sequelize/coverage) | ||
[![Dependency Status](https://img.shields.io/david/feathersjs/feathers-sequelize.svg?style=flat-square)](https://david-dm.org/feathersjs/feathers-sequelize) | ||
[![Build Status](https://travis-ci.org/feathersjs-ecosystem/feathers-sequelize.png?branch=master)](https://travis-ci.org/feathersjs-ecosystem/feathers-sequelize) | ||
[![Code Climate](https://codeclimate.com/github/feathersjs-ecosystem/feathers-sequelize.png)](https://codeclimate.com/github/feathersjs-ecosystem/feathers-sequelize) | ||
[![Test Coverage](https://codeclimate.com/github/feathersjs-ecosystem/feathers-sequelize/badges/coverage.svg)](https://codeclimate.com/github/feathersjs-ecosystem/feathers-sequelize/coverage) | ||
[![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) | ||
@@ -10,0 +10,0 @@ [![Slack Status](http://slack.feathersjs.com/badge.svg)](http://slack.feathersjs.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
491
51425
12