cleanup devicestatus delete

This commit is contained in:
Jeremy Cunningham
2018-12-07 17:39:11 -06:00
parent ff043944eb
commit 769b66ad7c
2 changed files with 4 additions and 24 deletions
+4 -12
View File
@@ -43,18 +43,6 @@ function configure (app, wares, ctx) {
api.post('/devicestatus/', ctx.authorization.isPermitted('api:devicestatus:create'), doPost);
api.delete('/devicestatus/:_id', ctx.authorization.isPermitted('api:devicestatus:delete'), function(req, res) {
console.log('Deleting id: ' + req.params._id);
ctx.devicestatus.remove_id(req.params._id, function (err, removed) {
if (err) {
res.sendJSONStatus(res, consts.HTTP_INTERNAL_ERROR, 'Mongo Error', err);
} else {
res.json(removed);
}
});
});
/**
* @function delete_records
* Delete devicestatus. The query logic works the same way as find/list. This
@@ -103,6 +91,10 @@ function configure (app, wares, ctx) {
} else {
req.query.find.type = req.params.spec;
}
if (req.query.find.type === '*') {
delete req.query.find.type;
}
}
next();
}, delete_records);