From 9ce808e9289a35998e0b2980e9f6f667cb470914 Mon Sep 17 00:00:00 2001 From: xfarrow Date: Wed, 27 Mar 2024 12:10:50 +0100 Subject: [PATCH] Update job_offer_validator.js --- .../utils/validators/job_offer_validator.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/backend/apis/nodejs/src/utils/validators/job_offer_validator.js b/backend/apis/nodejs/src/utils/validators/job_offer_validator.js index 1ae2d18..8988815 100644 --- a/backend/apis/nodejs/src/utils/validators/job_offer_validator.js +++ b/backend/apis/nodejs/src/utils/validators/job_offer_validator.js @@ -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');