use the correct id param for destroy and update

This commit is contained in:
Dan Ribbens
2019-09-17 11:35:10 -04:00
parent 332bcbe48d
commit 2e03577552
2 changed files with 2 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
import httpStatus from 'http-status';
const destroy = (req, res) => {
req.model.findOneAndDelete({ _id: req.params._id }, (err, doc) => {
req.model.findOneAndDelete({ _id: req.params.id }, (err, doc) => {
if (err)
return res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ error: err });

View File

@@ -2,7 +2,7 @@ import httpStatus from 'http-status';
const update = (req, res) => {
req.model.setDefaultLocale(req.locale); // TODO - move to middleware
req.model.findOne({ _id: req.params._id }, '', {}, (err, doc) => {
req.model.findOne({ _id: req.params.id }, '', {}, (err, doc) => {
if (!doc)
return res.status(httpStatus.NOT_FOUND).send('Not Found');