parent
e22b960d4e
commit
2e0f3d15f9
|
@ -103,7 +103,7 @@ module.exports = function(AccessToken) {
|
||||||
|
|
||||||
var id = tokenIdForRequest(req, options);
|
var id = tokenIdForRequest(req, options);
|
||||||
|
|
||||||
if (id) {
|
if (id != null) {
|
||||||
this.findById(id, function(err, token) {
|
this.findById(id, function(err, token) {
|
||||||
if (err) {
|
if (err) {
|
||||||
cb(err);
|
cb(err);
|
||||||
|
|
|
@ -161,13 +161,13 @@ module.exports = function(registry) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id && data) {
|
if (id != null && data) {
|
||||||
var model = new ModelCtor(data);
|
var model = new ModelCtor(data);
|
||||||
model.id = id;
|
model.id = id;
|
||||||
fn(null, model);
|
fn(null, model);
|
||||||
} else if (data) {
|
} else if (data) {
|
||||||
fn(null, new ModelCtor(data));
|
fn(null, new ModelCtor(data));
|
||||||
} else if (id) {
|
} else if (id != null) {
|
||||||
var filter = {};
|
var filter = {};
|
||||||
ModelCtor.findById(id, filter, options, function(err, model) {
|
ModelCtor.findById(id, filter, options, function(err, model) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -1683,7 +1683,7 @@ module.exports = function(registry) {
|
||||||
ctx.instance, ctx.currentInstance, ctx.where, ctx.data);
|
ctx.instance, ctx.currentInstance, ctx.where, ctx.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id) {
|
if (id != null) {
|
||||||
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
||||||
} else {
|
} else {
|
||||||
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
||||||
|
@ -1707,7 +1707,7 @@ module.exports = function(registry) {
|
||||||
debug('context instance:%j where:%j', ctx.instance, ctx.where);
|
debug('context instance:%j where:%j', ctx.instance, ctx.where);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id) {
|
if (id != null) {
|
||||||
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
||||||
} else {
|
} else {
|
||||||
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
||||||
|
|
Loading…
Reference in New Issue