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 = [
check('id').trim().notEmpty().escape(),
check('title').trim().notEmpty().escape(),
check('description').trim().escape(),
check('requirements').trim().escape(),
check('title').trim().notEmpty().escape().isLength({
max: 2048
}),
check('description').trim().escape().isLength({
max: 4096
}),
check('requirements').trim().escape().isLength({
max: 4096
}),
check('salary').trim().notEmpty().escape().isCurrency(),
check('salary_frequency').trim().notEmpty().escape(),
check('salary_currency').trim().notEmpty().escape(),
check('location').trim().escape(),
check('salary_frequency').trim().notEmpty().escape().isLength({
max: 64
}),
check('salary_currency').trim().notEmpty().escape().isLength({
max: 64
}),
check('location').trim().escape().isLength({
max: 256
}),
check('tags').custom(tags => {
if (!Array.isArray(tags)) {
throw new Error('tags must be an array');