Skip to content

Commit 09368f1

Browse files
committed
fix: allow empty string
1 parent ff91b38 commit 09368f1

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

src/services/JobService.js

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -187,31 +187,35 @@ async function createJob (currentUser, job) {
187187
return created.toJSON()
188188
}
189189

190-
createJob.schema = Joi.object().keys({
191-
currentUser: Joi.object().required(),
192-
job: Joi.object().keys({
193-
status: Joi.jobStatus().default('sourcing'),
194-
projectId: Joi.number().integer().required(),
195-
externalId: Joi.string().allow(null),
196-
description: Joi.stringAllowEmpty().allow(null),
197-
title: Joi.title().required(),
198-
startDate: Joi.date().allow(null),
199-
duration: Joi.number().integer().min(1).allow(null),
200-
numPositions: Joi.number().integer().min(1).required(),
201-
resourceType: Joi.stringAllowEmpty().allow(null),
202-
rateType: Joi.rateType().allow(null),
203-
workload: Joi.workload().allow(null),
204-
skills: Joi.array().items(Joi.string().uuid()).required(),
205-
isApplicationPageActive: Joi.boolean(),
206-
minSalary: Joi.number().integer().allow(null),
207-
maxSalary: Joi.number().integer().allow(null),
208-
hoursPerWeek: Joi.number().integer().allow(null),
209-
jobLocation: Joi.string().stringAllowEmpty().allow(null),
210-
jobTimezone: Joi.string().stringAllowEmpty().allow(null),
211-
currency: Joi.string().stringAllowEmpty().allow(null),
212-
roleIds: Joi.array().items(Joi.string().uuid().required())
213-
}).required()
214-
}).required()
190+
createJob.schema = Joi.object()
191+
.keys({
192+
currentUser: Joi.object().required(),
193+
job: Joi.object()
194+
.keys({
195+
status: Joi.jobStatus().default("sourcing"),
196+
projectId: Joi.number().integer().required(),
197+
externalId: Joi.string().allow(null),
198+
description: Joi.stringAllowEmpty().allow(null),
199+
title: Joi.title().required(),
200+
startDate: Joi.date().allow(null),
201+
duration: Joi.number().integer().min(1).allow(null),
202+
numPositions: Joi.number().integer().min(1).required(),
203+
resourceType: Joi.stringAllowEmpty().allow(null),
204+
rateType: Joi.rateType().allow(null),
205+
workload: Joi.workload().allow(null),
206+
skills: Joi.array().items(Joi.string().uuid()).required(),
207+
isApplicationPageActive: Joi.boolean(),
208+
minSalary: Joi.number().integer().allow(null),
209+
maxSalary: Joi.number().integer().allow(null),
210+
hoursPerWeek: Joi.number().integer().allow(null),
211+
jobLocation: Joi.string().allow(null).stringAllowEmpty(),
212+
jobTimezone: Joi.string().allow(null).stringAllowEmpty(),
213+
currency: Joi.string().allow(null).stringAllowEmpty(),
214+
roleIds: Joi.array().items(Joi.string().uuid().required()),
215+
})
216+
.required(),
217+
})
218+
.required();
215219

216220
/**
217221
* Update job. Normal user can only update the job he/she created.

0 commit comments

Comments
 (0)