Skip to content

Commit 049f332

Browse files
now max and min only optional for freelance
1 parent 3f59392 commit 049f332

File tree

6 files changed

+5
-3
lines changed

6 files changed

+5
-3
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ADMIN_PASSWORD=n1j0bs_ftw.12345
3636

3737
# List of regexes or url's specifying allowed origins. Example:
3838
# ACCESS_CONTROL_ALLOW_ORIGINS=["https:\\/\\/deploy-preview-\\d+--nijobs\\.netlify\\.app", "https://nijobs.netlify.app"]
39-
ACCESS_CONTROL_ALLOW_ORIGINS=
39+
ACCESS_CONTROL_ALLOW_ORIGINS=["https:\\/\\/deploy-preview-\\d+--nijobs\\.netlify\\.app", "https://nijobs.netlify.app","https://localhost"]
4040

4141
# 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
4242
# However, if you want to send emails, you need to fill all of the following 2 fields

NODE_ENV=test

Whitespace-only changes.

eslint

Whitespace-only changes.

[email protected]

Whitespace-only changes.

npm

Whitespace-only changes.

src/api/middleware/validators/offer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,17 @@ export const create = useExpressValidators([
8282

8383

8484
body("jobMinDuration", ValidationReasons.DEFAULT)
85-
.optional()
85+
.if((value, { req }) => req.body.jobType !== "FREELANCE")
8686
.exists().withMessage(ValidationReasons.REQUIRED).bail()
8787
.isInt().withMessage(ValidationReasons.INT),
88+
8889

8990
body("jobMaxDuration", ValidationReasons.DEFAULT)
90-
.optional()
91+
.if((value, { req }) => req.body.jobType !== "FREELANCE")
9192
.exists().withMessage(ValidationReasons.REQUIRED).bail()
9293
.isInt().withMessage(ValidationReasons.INT).bail()
9394
.custom(jobMaxDurationGreaterOrEqualThanJobMinDuration),
95+
9496

9597
body("jobStartDate", ValidationReasons.DEFAULT)
9698
.optional()

0 commit comments

Comments
 (0)