mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Fixed delete devicestatus by id.
This commit is contained in:
@@ -2,12 +2,6 @@
|
||||
|
||||
var consts = require('../../constants');
|
||||
|
||||
var ID_PATTERN = /^[a-f\d]{24}$/;
|
||||
|
||||
function isId(value) {
|
||||
return value && ID_PATTERN.test(value) && value.length === 24;
|
||||
}
|
||||
|
||||
function configure (app, wares, ctx) {
|
||||
var express = require('express'),
|
||||
api = express.Router( );
|
||||
@@ -80,7 +74,7 @@ function configure (app, wares, ctx) {
|
||||
api.delete('/devicestatus/:_id', ctx.authorization.isPermitted('api:devicestatus:delete'), function(req, res) {
|
||||
console.log('Deleting id: ' + req.params._id);
|
||||
|
||||
ctx.devicestatus.remove(req.params._id, function (err, removed) {
|
||||
ctx.devicestatus.remove_id(req.params._id, function (err, removed) {
|
||||
if (err) {
|
||||
res.sendJSONStatus(res, consts.HTTP_INTERNAL_ERROR, 'Mongo Error', err);
|
||||
} else {
|
||||
@@ -89,7 +83,7 @@ function configure (app, wares, ctx) {
|
||||
});
|
||||
});
|
||||
|
||||
// delete record
|
||||
// delete record that match query
|
||||
api.delete('/devicestatus/', ctx.authorization.isPermitted('api:devicestatus:delete'), function(req, res, next) {
|
||||
next();
|
||||
}, delete_records);
|
||||
|
||||
Reference in New Issue
Block a user