Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[email protected] breaks build 🚨 #30

Merged
merged 2 commits into from
Jul 8, 2016
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
"npm": ">=1.4.0"
},
"dependencies": {
"babel-polyfill": "^6.7.4",
"feathers-errors": "^2.0.1",
"feathers-query-filters": "^1.5.1",
"lodash.omit": "^4.3.0",
"uberproto": "^1.2.0"
},
"devDependencies": {
Expand All @@ -60,7 +60,7 @@
"chai": "^3.0.0",
"feathers": "^2.0.0-pre.4",
"feathers-rest": "^1.3.0",
"feathers-service-tests": "^0.6.0",
"feathers-service-tests": "^0.6.1",
"feathers-socketio": "^1.3.3",
"jshint": "^2.8.0",
"mocha": "^2.5.0",
Expand Down
20 changes: 6 additions & 14 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
if(!global._babelPolyfill) { require('babel-polyfill'); }

import omit from 'lodash.omit';
import Proto from 'uberproto';
import filter from 'feathers-query-filters';
import errors from 'feathers-errors';
Expand Down Expand Up @@ -110,13 +109,10 @@ class Service {
patch(id, data, params) {
let { query, options } = multiOptions(id, this.id, params);

// We can not update the id
delete data[this.id];
delete data._id;

// Run the query
return nfcall(this.Model, 'update', query, { $set: data }, options)
.then(() => this._findOrGet(id, params));
return nfcall(this.Model, 'update', query, {
$set: omit(data, this.id, '_id')
}, options).then(() => this._findOrGet(id, params));
}

update(id, data, params) {
Expand All @@ -125,12 +121,8 @@ class Service {
}

let { query, options } = multiOptions(id, this.id, params);

// We can not update the id
data[this.id] = id;
delete data._id;

return nfcall(this.Model, 'update', query, data, options)

return nfcall(this.Model, 'update', query, omit(data, this.id, '_id'), options)
.then(() => this._findOrGet(id));
}

Expand Down