Removed obsolete dir
Numeric conversions for all ids coming in as route req params. Infrastructure for proper error message when dependencies prevent entity deletion.
This commit is contained in:
parent
2b57396a5d
commit
0a08088893
636 changed files with 291 additions and 73346 deletions
|
@ -5,7 +5,8 @@ let _ = require('./translate')._;
|
|||
module.exports = {
|
||||
enforce,
|
||||
cleanupFromPost,
|
||||
filterObject
|
||||
filterObject,
|
||||
castToInteger
|
||||
};
|
||||
|
||||
function enforce(condition, message) {
|
||||
|
@ -27,4 +28,14 @@ function filterObject(obj, allowedKeys) {
|
|||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function castToInteger(id) {
|
||||
const val = parseInt(id);
|
||||
|
||||
if (!Number.isInteger(val)) {
|
||||
throw new Error('Invalid id');
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue