From 1a4b8bf46465b64895be91c9663221e3a9fe37ce Mon Sep 17 00:00:00 2001 From: Joe Fong Date: Mon, 11 Nov 2024 12:21:03 +0000 Subject: [PATCH] remove unused code, minor fix --- .../models/BulkImport/csv/crossValidate.js | 4 ---- .../BulkImport/csv/crossValidateErrors.js | 24 +++++++++---------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/backend/server/models/BulkImport/csv/crossValidate.js b/backend/server/models/BulkImport/csv/crossValidate.js index 94e05399a9..8da6dc14c7 100644 --- a/backend/server/models/BulkImport/csv/crossValidate.js +++ b/backend/server/models/BulkImport/csv/crossValidate.js @@ -171,10 +171,6 @@ const _buildWorkplaceDictWithNewWorkers = (allNewWorkers) => { .value(); }; -const _addErrorForWorkersWithSameRefsMovingToSameWorkplace = (csvWorkerSchemaErrors, JSONWorker) => { - addCrossValidateError(csvWorkerSchemaErrors, TRANSFER_STAFF_RECORD_ERRORS.SameRefsMovingToWorkplace, JSONWorker); -}; - module.exports = { crossValidate, _crossValidateMainJobRole, diff --git a/backend/server/models/BulkImport/csv/crossValidateErrors.js b/backend/server/models/BulkImport/csv/crossValidateErrors.js index aa04e2414a..560254e91b 100644 --- a/backend/server/models/BulkImport/csv/crossValidateErrors.js +++ b/backend/server/models/BulkImport/csv/crossValidateErrors.js @@ -1,41 +1,41 @@ const MAIN_JOB_ROLE_ERROR_CODE = 1280; const TRANSFER_STAFF_RECORD_BASE_ERROR_CODE = 1400; -const MAIN_JOB_ERRORS = Object.freeze({ - RegisteredManagerWithoutCqcRegulatedService: { +const MAIN_JOB_ERRORS = { + RegisteredManagerWithoutCqcRegulatedService: Object.freeze({ errCode: MAIN_JOB_ROLE_ERROR_CODE, errType: 'MAIN_JOB_ROLE_ERROR', column: 'MAINJOBROLE', _sourceFieldName: 'mainJobRoleId', error: 'Workers MAINJOBROLE is Registered Manager but you are not providing a CQC regulated service. Please change to another Job Role', - }, -}); + }), +}; -const TRANSFER_STAFF_RECORD_ERRORS = Object.freeze({ - NewWorkplaceNotFound: { +const TRANSFER_STAFF_RECORD_ERRORS = { + NewWorkplaceNotFound: Object.freeze({ errCode: TRANSFER_STAFF_RECORD_BASE_ERROR_CODE + 1, errType: 'TRANSFERSTAFFRECORD_ERROR', column: 'TRANSFERSTAFFRECORD', _sourceFieldName: 'transferStaffRecord', error: 'Cannot find an existing workplace with the reference provided in TRANSFERSTAFFRECORD', - }, - SameLocalIdExistInNewWorkplace: { + }), + SameLocalIdExistInNewWorkplace: Object.freeze({ errCode: TRANSFER_STAFF_RECORD_BASE_ERROR_CODE + 2, errType: 'TRANSFERSTAFFRECORD_ERROR', column: 'UNIQUEWORKERID', _sourceFieldName: 'uniqueWorkerId', error: 'The UNIQUEWORKERID for this worker is already used in the new workplace given in TRANSFERSTAFFRECORD', - }, - SameRefsMovingToWorkplace: { + }), + SameRefsMovingToWorkplace: Object.freeze({ errCode: TRANSFER_STAFF_RECORD_BASE_ERROR_CODE + 3, errType: 'TRANSFERSTAFFRECORD_ERROR', column: 'UNIQUEWORKERID', _sourceFieldName: 'uniqueWorkerId', error: 'There are more than one worker with this UNIQUEWORKERID moving into the new workplace given in TRANSFERSTAFFRECORD.', - }, -}); + }), +}; const addCrossValidateError = (errorsArray, errorType, JSONWorker) => { const newErrorObject = {