Comparing version 0.3.4 to 0.3.5
@@ -109,3 +109,3 @@ 'use strict'; | ||
return id.id ? id : _lodash2['default'].find(store, { id: Number(id) }); | ||
}) : _lodash2['default'].find(store, { id: value }); | ||
}) : _lodash2['default'].find(store, { id: Number(value) }); | ||
}); | ||
@@ -413,21 +413,8 @@ | ||
console.log('updateResource from adapter'); | ||
console.log('update'); | ||
console.log(update); | ||
console.log('resource'); | ||
console.log(resource); | ||
// reject if resource not found | ||
if (!resource) return _bluebird2['default'].resolve(null); | ||
console.log('store before'); | ||
console.log(this.store[type]); | ||
// update the store | ||
this.store[type].splice(--id, 1, Object.assign(resource, update)); | ||
console.log('store after'); | ||
console.log(this.store[type]); | ||
return _bluebird2['default'].resolve(true); | ||
@@ -505,4 +492,2 @@ } | ||
console.log('deleting relationship in adapter'); | ||
// reject if resource not found | ||
@@ -517,3 +502,2 @@ if (!resource) return _bluebird2['default'].reject(null); | ||
} else { | ||
console.log('removing all'); | ||
// remove all | ||
@@ -523,4 +507,2 @@ resource[field] = []; | ||
console.log(this.store[type]); | ||
return new _bluebird2['default'].resolve(true); | ||
@@ -527,0 +509,0 @@ } |
@@ -263,8 +263,2 @@ 'use strict'; | ||
console.log('relationshipData'); | ||
console.log(relationshipData); | ||
console.log('isArray?:', _lodash2['default'].isArray(relationshipData)); | ||
console.log('isEmpty?:', _lodash2['default'].isEmpty(relationshipData)); | ||
if (_lodash2['default'].isEmpty(relationshipData) && _lodash2['default'].isArray(relationshipData)) { | ||
@@ -330,5 +324,2 @@ serialized[relationship] = []; | ||
value: function updateResource(id, body) { | ||
console.log('body before serializing the request'); | ||
console.log(body); | ||
if (body.data) { | ||
@@ -338,7 +329,2 @@ body = this.serializeRequest(body); | ||
console.log('body after serializing the request'); | ||
console.log(body); | ||
console.log('updateResource from model'); | ||
return this.adapter.updateResource(this, id, body); | ||
@@ -345,0 +331,0 @@ } |
@@ -653,4 +653,2 @@ // dependencies | ||
console.log('updating resource from router'); | ||
return _this.updateResource(req, res, next); | ||
@@ -657,0 +655,0 @@ }) |
@@ -80,3 +80,3 @@ import Promise from 'bluebird'; | ||
? (_.map(value, id => id.id ? id : _.find(store, { id: Number(id) }))) | ||
: (_.find(store, { id: value })); | ||
: (_.find(store, { id: Number(value) })); | ||
}); | ||
@@ -83,0 +83,0 @@ |
{ | ||
"name": "restle", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "JSON API engine.", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
308676
8002