Rough in strain editing

This commit is contained in:
Matthew Dillon 2015-04-27 10:27:20 -08:00
parent f902c7500b
commit e2aa298a8f
4 changed files with 93 additions and 12 deletions

View file

@ -100,9 +100,17 @@ module.exports = function(app) {
var strains = STRAINS.filter(function(s) {
return s.id == req.params.id;
});
res.send({
'strain': strains[0]
});
if (strains.length === 0) {
res.status(422).send({
'errors':{
"strainName": ["error1"],
"typeStrain": ["error2", "error3"],
"isolatedFrom": ["error4"]
}
}).end();
} else {
res.status(204).end();
}
});
strainsRouter.delete('/:id', function(req, res) {