From d85138d52583becc39665cc0d91e0c1682f293b7 Mon Sep 17 00:00:00 2001 From: Cagdas U Date: Mon, 10 May 2021 08:21:59 +0300 Subject: [PATCH 1/5] feat(interview-scheduler): update mapping & validations for the new model Update ES mappings & Joi validations for the new changes on Interview schema. * Add `xaiId` field. * Add `rescheduleUrl` field. * Add `endTimestamp` field. * Add `duration` field. * Add `templateId` field. * Add `templateType` field. * Add `title` field. * Add `locationDetails` field. * Add `hostName` field. * Add `hostEmail` field. * Add `guestNames` field. * Rename field `attendeesList` to `guestEmails` * Rename field `googleCalendarId` to `calendarEventId` * Rename field `xaiTemplate` to `templateUrl` * Remove `customMessage` field --- src/scripts/createIndex.js | 20 +++++++++++++++----- src/services/InterviewProcessorService.js | 18 ++++++++++++++---- src/services/JobCandidateProcessorService.js | 4 ++-- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/scripts/createIndex.js b/src/scripts/createIndex.js index dc0d213..84325e2 100644 --- a/src/scripts/createIndex.js +++ b/src/scripts/createIndex.js @@ -50,14 +50,24 @@ async function createIndex () { type: 'nested', properties: { id: { type: 'keyword' }, + xaiId: { type: 'keyword' }, jobCandidateId: { type: 'keyword' }, - googleCalendarId: { type: 'keyword' }, - customMessage: { type: 'text' }, - xaiTemplate: { type: 'keyword' }, - round: { type: 'integer' }, + calendarEventId: { type: 'keyword' }, + templateUrl: { type: 'keyword' }, + templateId: { type: 'keyword' }, + templateType: { type: 'keyword' }, + title: { type: 'keyword' }, + locationDetails: { type: 'keyword' }, + duration: { type: 'integer' }, startTimestamp: { type: 'date' }, - attendeesList: [], + endTimestamp: { type: 'date' }, + hostName: { type: 'keyword' }, + hostEmail: { type: 'keyword' }, + guestNames: { type: 'keyword' }, + guestEmails: { type: 'keyword' }, + round: { type: 'integer' }, status: { type: 'keyword' }, + rescheduleUrl: { type: 'keyword' }, createdAt: { type: 'date' }, createdBy: { type: 'keyword' }, updatedAt: { type: 'date' }, diff --git a/src/services/InterviewProcessorService.js b/src/services/InterviewProcessorService.js index 2c3d595..0879589 100644 --- a/src/services/InterviewProcessorService.js +++ b/src/services/InterviewProcessorService.js @@ -58,14 +58,24 @@ processRequestInterview.schema = { 'mime-type': Joi.string().required(), payload: Joi.object().keys({ id: Joi.string().uuid().required(), + xaiId: Joi.string().uuid().allow(null), jobCandidateId: Joi.string().uuid().required(), - googleCalendarId: Joi.string().allow(null), - customMessage: Joi.string().allow(null), - xaiTemplate: Joi.xaiTemplate().required(), + calendarEventId: Joi.string().allow(null), + templateUrl: Joi.xaiTemplate().required(), + templateId: Joi.string().uuid().allow(null), + templateType: Joi.string().allow(null), + title: Joi.string().uuid().allow(null), + locationDetails: Joi.string().uuid().allow(null), round: Joi.number().integer().positive().required(), + duration: Joi.number().integer().positive().required(), startTimestamp: Joi.date().allow(null), - attendeesList: Joi.array().items(Joi.string().email()).allow(null), + endTimestamp: Joi.date().allow(null), + hostName: Joi.string().required(), + hostEmail: Joi.string().email().required(), + guestNames: Joi.array().items(Joi.string()).allow(null), + guestEmails: Joi.array().items(Joi.string().email()).allow(null), status: Joi.interviewStatus().required(), + rescheduleUrl: Joi.string().allow(null), createdAt: Joi.date().required(), createdBy: Joi.string().uuid().required(), updatedAt: Joi.date().allow(null), diff --git a/src/services/JobCandidateProcessorService.js b/src/services/JobCandidateProcessorService.js index 051af9a..48d8660 100644 --- a/src/services/JobCandidateProcessorService.js +++ b/src/services/JobCandidateProcessorService.js @@ -25,8 +25,8 @@ async function updateCandidateStatus ({ type, payload, previousData }) { localLogger.debug({ context: 'updateCandidateStatus', message: `jobCandidate is already in status: ${payload.status}` }) return } - //if (!['rejected', 'shortlist',].includes(payload.status)) { - if (!['client rejected - screening', 'client rejected - interview','interview','selected'].includes(payload.status)) { + // if (!['rejected', 'shortlist',].includes(payload.status)) { + if (!['client rejected - screening', 'client rejected - interview', 'interview', 'selected'].includes(payload.status)) { localLogger.debug({ context: 'updateCandidateStatus', message: `not interested status: ${payload.status}` }) return } From d9aff64a836d94226019abc1cd44fac366712311 Mon Sep 17 00:00:00 2001 From: urwithat Date: Tue, 11 May 2021 21:36:31 +0530 Subject: [PATCH 2/5] Changed xaiId & templateId from UUID to String --- src/services/InterviewProcessorService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/InterviewProcessorService.js b/src/services/InterviewProcessorService.js index 0879589..0994b5a 100644 --- a/src/services/InterviewProcessorService.js +++ b/src/services/InterviewProcessorService.js @@ -58,11 +58,11 @@ processRequestInterview.schema = { 'mime-type': Joi.string().required(), payload: Joi.object().keys({ id: Joi.string().uuid().required(), - xaiId: Joi.string().uuid().allow(null), + xaiId: Joi.string().allow(null), jobCandidateId: Joi.string().uuid().required(), calendarEventId: Joi.string().allow(null), templateUrl: Joi.xaiTemplate().required(), - templateId: Joi.string().uuid().allow(null), + templateId: Joi.string().allow(null), templateType: Joi.string().allow(null), title: Joi.string().uuid().allow(null), locationDetails: Joi.string().uuid().allow(null), From 151c253cec5695af4ef8398c9a91b2a9696fe197 Mon Sep 17 00:00:00 2001 From: urwithat Date: Tue, 11 May 2021 21:50:12 +0530 Subject: [PATCH 3/5] Bug Fix title was GUID --- src/services/InterviewProcessorService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/InterviewProcessorService.js b/src/services/InterviewProcessorService.js index 0994b5a..b3ae8e2 100644 --- a/src/services/InterviewProcessorService.js +++ b/src/services/InterviewProcessorService.js @@ -64,7 +64,7 @@ processRequestInterview.schema = { templateUrl: Joi.xaiTemplate().required(), templateId: Joi.string().allow(null), templateType: Joi.string().allow(null), - title: Joi.string().uuid().allow(null), + title: Joi.string().allow(null), locationDetails: Joi.string().uuid().allow(null), round: Joi.number().integer().positive().required(), duration: Joi.number().integer().positive().required(), From 2446ba37aefbb57fdcfc4bdb1c67816b438406af Mon Sep 17 00:00:00 2001 From: urwithat Date: Tue, 11 May 2021 21:59:54 +0530 Subject: [PATCH 4/5] Bug Fix locationDetails was GUID --- src/services/InterviewProcessorService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/InterviewProcessorService.js b/src/services/InterviewProcessorService.js index b3ae8e2..da49774 100644 --- a/src/services/InterviewProcessorService.js +++ b/src/services/InterviewProcessorService.js @@ -65,7 +65,7 @@ processRequestInterview.schema = { templateId: Joi.string().allow(null), templateType: Joi.string().allow(null), title: Joi.string().allow(null), - locationDetails: Joi.string().uuid().allow(null), + locationDetails: Joi.string().allow(null), round: Joi.number().integer().positive().required(), duration: Joi.number().integer().positive().required(), startTimestamp: Joi.date().allow(null), From 4fbacc53794c6c97e75b78001d894824e8939eba Mon Sep 17 00:00:00 2001 From: urwithat Date: Wed, 12 May 2021 19:09:02 +0530 Subject: [PATCH 5/5] Added updatedBy for Interviews --- src/scripts/createIndex.js | 3 ++- src/services/InterviewProcessorService.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scripts/createIndex.js b/src/scripts/createIndex.js index 84325e2..987df1b 100644 --- a/src/scripts/createIndex.js +++ b/src/scripts/createIndex.js @@ -71,7 +71,8 @@ async function createIndex () { createdAt: { type: 'date' }, createdBy: { type: 'keyword' }, updatedAt: { type: 'date' }, - updatedBy: { type: 'keyword' } + updatedBy: { type: 'keyword' }, + deletedAt: { type: 'date' } } }, createdAt: { type: 'date' }, diff --git a/src/services/InterviewProcessorService.js b/src/services/InterviewProcessorService.js index da49774..b7d2e2e 100644 --- a/src/services/InterviewProcessorService.js +++ b/src/services/InterviewProcessorService.js @@ -79,7 +79,8 @@ processRequestInterview.schema = { createdAt: Joi.date().required(), createdBy: Joi.string().uuid().required(), updatedAt: Joi.date().allow(null), - updatedBy: Joi.string().uuid().allow(null) + updatedBy: Joi.string().uuid().allow(null), + deletedAt: Joi.date().allow(null) }).required() }).required(), transactionId: Joi.string().required()