Skip to content

Commit 6603c8c

Browse files
committed
Fix joi validation for endTimestamp
1 parent ebfb59d commit 6603c8c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/services/InterviewService.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,9 @@ partiallyUpdateInterviewByRound.schema = Joi.object().keys({
341341
then: Joi.required(),
342342
otherwise: Joi.allow(null)
343343
}),
344-
endTimestamp: Joi.date().greater('now').when('startTimestamp', {
345-
is: Joi.required(),
346-
then: Joi.date().greater(Joi.ref('startTimestamp')),
344+
endTimestamp: Joi.date().greater(Joi.ref('startTimestamp')).when('status', {
345+
is: [InterviewConstants.Status.Scheduled, InterviewConstants.Status.Rescheduled],
346+
then: Joi.required(),
347347
otherwise: Joi.allow(null)
348348
}),
349349
hostName: Joi.string(),
@@ -401,9 +401,9 @@ partiallyUpdateInterviewById.schema = Joi.object().keys({
401401
then: Joi.required(),
402402
otherwise: Joi.allow(null)
403403
}),
404-
endTimestamp: Joi.date().greater('now').when('startTimestamp', {
405-
is: Joi.required(),
406-
then: Joi.date().greater(Joi.ref('startTimestamp')),
404+
endTimestamp: Joi.date().greater(Joi.ref('startTimestamp')).when('status', {
405+
is: [InterviewConstants.Status.Scheduled, InterviewConstants.Status.Rescheduled],
406+
then: Joi.required(),
407407
otherwise: Joi.allow(null)
408408
}),
409409
hostName: Joi.string(),

0 commit comments

Comments
 (0)