Update job_offer_validator.js

This commit is contained in:
xfarrow 2024-03-27 12:10:50 +01:00
parent 44bf3a41c6
commit 9ce808e928
1 changed files with 18 additions and 6 deletions

View File

@ -21,13 +21,25 @@ const {
const insertValidator = [ const insertValidator = [
check('id').trim().notEmpty().escape(), check('id').trim().notEmpty().escape(),
check('title').trim().notEmpty().escape(), check('title').trim().notEmpty().escape().isLength({
check('description').trim().escape(), max: 2048
check('requirements').trim().escape(), }),
check('description').trim().escape().isLength({
max: 4096
}),
check('requirements').trim().escape().isLength({
max: 4096
}),
check('salary').trim().notEmpty().escape().isCurrency(), check('salary').trim().notEmpty().escape().isCurrency(),
check('salary_frequency').trim().notEmpty().escape(), check('salary_frequency').trim().notEmpty().escape().isLength({
check('salary_currency').trim().notEmpty().escape(), max: 64
check('location').trim().escape(), }),
check('salary_currency').trim().notEmpty().escape().isLength({
max: 64
}),
check('location').trim().escape().isLength({
max: 256
}),
check('tags').custom(tags => { check('tags').custom(tags => {
if (!Array.isArray(tags)) { if (!Array.isArray(tags)) {
throw new Error('tags must be an array'); throw new Error('tags must be an array');