diff --git a/.env b/.env index 454dee8a..281a1752 100644 --- a/.env +++ b/.env @@ -36,7 +36,7 @@ ADMIN_PASSWORD=n1j0bs_ftw.12345 # List of regexes or url's specifying allowed origins. Example: # ACCESS_CONTROL_ALLOW_ORIGINS=["https:\\/\\/deploy-preview-\\d+--nijobs\\.netlify\\.app", "https://nijobs.netlify.app"] -ACCESS_CONTROL_ALLOW_ORIGINS= +ACCESS_CONTROL_ALLOW_ORIGINS=["https:\\/\\/deploy-preview-\\d+--nijobs\\.netlify\\.app", "https://nijobs.netlify.app","https://localhost"] # Mail service information. If you don't provide a MAIL_FROM, no emails will be sent. The app will execute no-ops and won't crash # However, if you want to send emails, you need to fill all of the following 2 fields diff --git a/NODE_ENV=test b/NODE_ENV=test deleted file mode 100644 index e69de29b..00000000 diff --git a/eslint b/eslint deleted file mode 100644 index e69de29b..00000000 diff --git a/nijobs-be@1.0.0 b/nijobs-be@1.0.0 deleted file mode 100644 index e69de29b..00000000 diff --git a/npm b/npm deleted file mode 100644 index e69de29b..00000000 diff --git a/src/api/middleware/validators/offer.js b/src/api/middleware/validators/offer.js index 678d8d62..2e6ee670 100644 --- a/src/api/middleware/validators/offer.js +++ b/src/api/middleware/validators/offer.js @@ -82,15 +82,17 @@ export const create = useExpressValidators([ body("jobMinDuration", ValidationReasons.DEFAULT) - .optional() + .if((value, { req }) => req.body.jobType !== "FREELANCE") .exists().withMessage(ValidationReasons.REQUIRED).bail() .isInt().withMessage(ValidationReasons.INT), + body("jobMaxDuration", ValidationReasons.DEFAULT) - .optional() + .if((value, { req }) => req.body.jobType !== "FREELANCE") .exists().withMessage(ValidationReasons.REQUIRED).bail() .isInt().withMessage(ValidationReasons.INT).bail() .custom(jobMaxDurationGreaterOrEqualThanJobMinDuration), + body("jobStartDate", ValidationReasons.DEFAULT) .optional()