Skip to content

Commit f62f440

Browse files
authored
use transactions in update, related to feathersjs-ecosystem#188
1 parent 6f5c547 commit f62f440

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,9 @@ class Service {
240240

241241
// Force the {raw: false} option as the instance is needed to properly
242242
// update
243+
const updateOptions = Object.assign({ raw: false }, params.sequelize);
243244

244-
return this._get(id, { sequelize: { raw: false }, query: where }).then(instance => {
245+
return this._get(id, { sequelize: updateOptions, query: where }).then(instance => {
245246
if (!instance) {
246247
throw new errors.NotFound(`No record found for id '${id}'`);
247248
}
@@ -255,7 +256,7 @@ class Service {
255256
}
256257
});
257258

258-
return instance.update(copy, {raw: false}).then(() => this._get(id, {sequelize: options}));
259+
return instance.update(copy, updateOptions).then(() => this._get(id, {sequelize: options}));
259260
})
260261
.then(select(params, this.id))
261262
.catch(utils.errorHandler);

0 commit comments

Comments
 (0)