diff --git a/src/routes/productCategories/create.js b/src/routes/productCategories/create.js index e80bc596..811c9fa7 100644 --- a/src/routes/productCategories/create.js +++ b/src/routes/productCategories/create.js @@ -41,10 +41,10 @@ module.exports = [ }); // Check if duplicated key - return models.ProductCategory.findById(req.body.param.key) + return models.ProductCategory.findById(req.body.param.key, { paranoid: false }) .then((existing) => { if (existing) { - const apiErr = new Error(`Product category already exists for key ${req.params.key}`); + const apiErr = new Error(`Product category already exists(may be deleted) for key "${req.body.param.key}"`); apiErr.status = 422; return Promise.reject(apiErr); } diff --git a/src/routes/projectTypes/create.js b/src/routes/projectTypes/create.js index 8e73e1ec..028f21bb 100644 --- a/src/routes/projectTypes/create.js +++ b/src/routes/projectTypes/create.js @@ -42,10 +42,10 @@ module.exports = [ }); // Check if duplicated key - return models.ProjectType.findById(req.body.param.key) + return models.ProjectType.findById(req.body.param.key, { paranoid: false }) .then((existing) => { if (existing) { - const apiErr = new Error(`Project type already exists for key ${req.params.key}`); + const apiErr = new Error(`Project type already exists(may be deleted) for key "${req.body.param.key}"`); apiErr.status = 422; return Promise.reject(apiErr); }