mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
cleanup devicestatus delete
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user