restful-goose
Advanced tools
Comparing version 1.3.5 to 1.3.6-a
@@ -11,3 +11,3 @@ var async = require('async'); | ||
_.forOwn(obj, function(value, key) { | ||
obj[key] = (Model.schema.paths[key].options.type.schemaName === 'String' || Model.schema.paths[key].options.type === String) ? { $regex: value, $options: 'i' } : value; | ||
obj[key] = (Model.schema.paths[key] && (Model.schema.paths[key].options.type.schemaName === 'String' || Model.schema.paths[key].options.type === String)) ? { $regex: value, $options: 'i' } : value; | ||
}); | ||
@@ -14,0 +14,0 @@ |
@@ -139,6 +139,13 @@ var express = require('express'); | ||
Model.findById(req.params.parent, function(err, parentDoc) { | ||
if (!parentDoc) { | ||
return res.__onError(req, res, { name: 'NotFound' }); | ||
} | ||
req.parent = parentDoc; | ||
req.parentPath = _.find(SubModel.schema.paths, function(p) { | ||
var parentPath = _.find(SubModel.schema.paths, function(p) { | ||
return p.options.ref === Model.modelName; | ||
}).path; | ||
}); | ||
if (!parentPath) { | ||
return res.__onError(req, res, { name: 'BadRequest' }); | ||
} | ||
req.parentPath = parentPath.path; | ||
req.baseURL = replaceSlashes(req.baseURL + '/' + parentDoc.id + '/relationships/' + subResource); | ||
@@ -145,0 +152,0 @@ next(); |
@@ -36,7 +36,5 @@ var express = require('express'); | ||
if (req.parent && req.parentPath) { | ||
console.log('hasParent'); | ||
if (!req.query) { | ||
req.query = {}; | ||
} | ||
console.log('parentPath: ' + req.parentPath); | ||
req.query[req.parentPath] = req.parent._id; | ||
@@ -71,2 +69,10 @@ } | ||
var attributes; | ||
if (typeof obj === 'string') { | ||
try { | ||
obj = JSON.parse(obj); | ||
} catch(e) { | ||
return res.__onError(req, res, { name: 'BadRequest' }); | ||
} | ||
} | ||
@@ -73,0 +79,0 @@ if (!obj || obj.hasOwnProperty('attributes') === false) { |
{ | ||
"name": "restful-goose", | ||
"version": "1.3.5", | ||
"version": "1.3.6a", | ||
"description": "Yet another RESTful microservice generator for Mongoose with an emphasis on flexibility", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
68387
1714
2
1
1