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:
Tomas Bures 2018-09-29 13:30:29 +02:00
parent 2b57396a5d
commit 0a08088893
636 changed files with 291 additions and 73346 deletions

View file

@ -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;
}