Skip to content

Commit

Permalink
Removes adapter.update from route
Browse files Browse the repository at this point in the history
Signed-off-by: Braden O'Guinn <braden.oguinn@mutualmobile.com>
  • Loading branch information
bradenoguinn committed Mar 18, 2015
1 parent ec4cbc6 commit fa6d85a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ function route(name, model, routeOptions) {

// update the resource
.then(function (update) {
return adapter.update(model, id, update);
return updateResource(model, id, update);
})

// do after transform
Expand Down Expand Up @@ -874,7 +874,7 @@ function findMany(model, query, limit, skip, sort, fields) {
limit = query;
}

model = typeof model == 'string' ? this._models[model] : model;
model = typeof model == 'string' ? adapter._models[model] : model;
limit = limit || 1000;
skip = skip ? skip : 0;
sort = sort || {"_id":-1};
Expand Down Expand Up @@ -910,10 +910,10 @@ function find(model, query) {
});
}

function update(model, id, update, options) {
function updateResource(model, id, update, options) {
var _this = this;
model = typeof model == 'string' ? this.model(model) : model;
update = this._serialize(model, update);
model = typeof model == 'string' ? adapter.model(model) : model;
update = serialize(update);

return new Promise(function (resolve, reject) {
var cb = function (error, resource) {
Expand All @@ -933,7 +933,7 @@ function update(model, id, update, options) {

function deleteResource(model, id) {
var _this = this;
model = typeof model == 'string' ? this.model(model) : model;
model = typeof model == 'string' ? adapter.model(model) : model;
return new Promise(function (resolve, reject) {
model.findByIdAndRemove(id, function (error, resource) {
resolve(deserialize(resource));
Expand Down

0 comments on commit fa6d85a

Please sign in to comment.