Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/routes/productCategories/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/projectTypes/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down