cleanup and tests

This commit is contained in:
Baris Usakli
2017-05-25 16:40:03 -04:00
parent 82cab53508
commit 062bced3dd
12 changed files with 587 additions and 559 deletions

View File

@@ -108,14 +108,15 @@ function expose(exposedField, method, field, req, res, next) {
if (!req.params.hasOwnProperty(field)) {
return next();
}
method(req.params[field], function (err, id) {
if (err) {
return next(err);
}
res.locals[exposedField] = id;
next();
});
async.waterfall([
function (next) {
method(req.params[field], next);
},
function (id, next) {
res.locals[exposedField] = id;
next();
},
], next);
}
middleware.privateUploads = function (req, res, next) {