Skip to content

Commit

Permalink
now max and min only optional for freelance
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-carlos-sousa committed Feb 28, 2024
1 parent 833242a commit a789bdc
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file removed NODE_ENV=test
Empty file.
Empty file removed eslint
Empty file.
Empty file removed [email protected]
Empty file.
Empty file removed npm
Empty file.
6 changes: 4 additions & 2 deletions src/api/middleware/validators/offer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a789bdc

Please sign in to comment.