From 1d19d13faa6816b2c396e0cea589e1a8c581f940 Mon Sep 17 00:00:00 2001 From: imcaizheng Date: Wed, 10 Feb 2021 07:12:42 +0800 Subject: [PATCH] Fix PUT operations: fully replace the content of a record with a new one --- docs/swagger.yaml | 1 - src/services/JobCandidateService.js | 6 +++--- src/services/JobService.js | 16 ++++++++-------- src/services/ResourceBookingService.js | 12 ++++++------ 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 4d3f463d..03848eab 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -2003,7 +2003,6 @@ components: required: - projectId - userId - - status - rateType properties: projectId: diff --git a/src/services/JobCandidateService.js b/src/services/JobCandidateService.js index e4d4f92a..0dec8a18 100644 --- a/src/services/JobCandidateService.js +++ b/src/services/JobCandidateService.js @@ -173,9 +173,9 @@ fullyUpdateJobCandidate.schema = Joi.object().keys({ data: Joi.object().keys({ jobId: Joi.string().uuid().required(), userId: Joi.string().uuid().required(), - status: Joi.jobCandidateStatus(), - externalId: Joi.string().allow(null), - resume: Joi.string().uri().allow(null) + status: Joi.jobCandidateStatus().default('open'), + externalId: Joi.string().allow(null).default(null), + resume: Joi.string().uri().allow(null).default(null) }).required() }).required() diff --git a/src/services/JobService.js b/src/services/JobService.js index 00167e03..5f2f3f01 100644 --- a/src/services/JobService.js +++ b/src/services/JobService.js @@ -252,17 +252,17 @@ fullyUpdateJob.schema = Joi.object().keys({ id: Joi.string().guid().required(), data: Joi.object().keys({ projectId: Joi.number().integer().required(), - externalId: Joi.string().allow(null), - description: Joi.stringAllowEmpty().allow(null), + externalId: Joi.string().allow(null).default(null), + description: Joi.stringAllowEmpty().allow(null).default(null), title: Joi.title().required(), - startDate: Joi.date().allow(null), - endDate: Joi.date().allow(null), + startDate: Joi.date().allow(null).default(null), + endDate: Joi.date().allow(null).default(null), numPositions: Joi.number().integer().min(1).required(), - resourceType: Joi.stringAllowEmpty().allow(null), - rateType: Joi.rateType().allow(null), - workload: Joi.workload().allow(null), + resourceType: Joi.stringAllowEmpty().allow(null).default(null), + rateType: Joi.rateType().allow(null).default(null), + workload: Joi.workload().allow(null).default(null), skills: Joi.array().items(Joi.string().uuid()).required(), - status: Joi.jobStatus() + status: Joi.jobStatus().default('sourcing') }).required() }).required() diff --git a/src/services/ResourceBookingService.js b/src/services/ResourceBookingService.js index a29b3445..120b9539 100644 --- a/src/services/ResourceBookingService.js +++ b/src/services/ResourceBookingService.js @@ -194,13 +194,13 @@ fullyUpdateResourceBooking.schema = Joi.object().keys({ data: Joi.object().keys({ projectId: Joi.number().integer().required(), userId: Joi.string().uuid().required(), - jobId: Joi.string().uuid().allow(null), - startDate: Joi.date().allow(null), - endDate: Joi.date().allow(null), - memberRate: Joi.number().allow(null), - customerRate: Joi.number().allow(null), + jobId: Joi.string().uuid().allow(null).default(null), + startDate: Joi.date().allow(null).default(null), + endDate: Joi.date().allow(null).default(null), + memberRate: Joi.number().allow(null).default(null), + customerRate: Joi.number().allow(null).default(null), rateType: Joi.rateType().required(), - status: Joi.jobStatus().required() + status: Joi.jobStatus().default('sourcing') }).required() }).required()