Fixed delete devicestatus by id.

This commit is contained in:
Jeremy Cunningham
2018-08-08 22:29:16 -05:00
parent bf72ccd7e9
commit bc99e63015
2 changed files with 13 additions and 9 deletions
+2 -8
View File
@@ -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);