-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
204 changed files
with
13,401 additions
and
6,449 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
backend/migrations/20241008122413-createTableForQualificationsCertificates.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
'use strict'; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
return queryInterface.createTable( | ||
'QualificationCertificates', | ||
{ | ||
ID: { | ||
type: Sequelize.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
}, | ||
UID: { | ||
type: Sequelize.DataTypes.UUID, | ||
defaultValue: Sequelize.literal('uuid_generate_v4()'), | ||
allowNull: false, | ||
unique: true, | ||
}, | ||
WorkerQualificationsFK: { | ||
type: Sequelize.DataTypes.INTEGER, | ||
allowNull: false, | ||
references: { | ||
model: { | ||
tableName: 'WorkerQualifications', | ||
schema: 'cqc', | ||
}, | ||
key: 'ID', | ||
}, | ||
}, | ||
WorkerFK: { | ||
type: Sequelize.DataTypes.INTEGER, | ||
allowNull: false, | ||
references: { | ||
model: { | ||
tableName: 'Worker', | ||
schema: 'cqc', | ||
}, | ||
key: 'ID', | ||
}, | ||
}, | ||
FileName: { | ||
type: Sequelize.DataTypes.TEXT, | ||
allowNull: false, | ||
}, | ||
UploadDate: { | ||
type: Sequelize.DataTypes.DATE, | ||
allowNull: true, | ||
}, | ||
Key: { | ||
type: Sequelize.DataTypes.TEXT, | ||
allowNull: false, | ||
}, | ||
}, | ||
{ schema: 'cqc' }, | ||
); | ||
}, | ||
|
||
async down(queryInterface) { | ||
/** | ||
* Add reverting commands here. | ||
* | ||
* Example: | ||
* await queryInterface.dropTable('users'); | ||
*/ | ||
return queryInterface.dropTable({ | ||
tableName: 'QualificationCertificates', | ||
schema: 'cqc', | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
backend/server/models/BulkImport/csv/crossValidateErrors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const MAIN_JOB_ROLE_ERROR_CODE = 1280; | ||
const TRANSFER_STAFF_RECORD_BASE_ERROR_CODE = 1400; | ||
|
||
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 = { | ||
NewWorkplaceNotFound: Object.freeze({ | ||
errCode: TRANSFER_STAFF_RECORD_BASE_ERROR_CODE + 1, | ||
errType: 'TRANSFERSTAFFRECORD_ERROR', | ||
column: 'TRANSFERSTAFFRECORD', | ||
_sourceFieldName: 'transferStaffRecord', | ||
error: 'The LOCALESTID in TRANSFERSTAFFRECORD does not exist', | ||
}), | ||
SameLocalIdExistInNewWorkplace: Object.freeze({ | ||
errCode: TRANSFER_STAFF_RECORD_BASE_ERROR_CODE + 2, | ||
errType: 'TRANSFERSTAFFRECORD_ERROR', | ||
column: 'UNIQUEWORKERID', | ||
_sourceFieldName: 'uniqueWorkerId', | ||
error: | ||
"The UNIQUEWORKERID already exists in the LOCALESTID given in TRANSFERSTAFFRECORD. Use CHGUNIQUEWRKID to change this worker's UNIQUEWORKERID", | ||
}), | ||
SameRefsMovingToWorkplace: Object.freeze({ | ||
errCode: TRANSFER_STAFF_RECORD_BASE_ERROR_CODE + 3, | ||
errType: 'TRANSFERSTAFFRECORD_ERROR', | ||
column: 'UNIQUEWORKERID', | ||
_sourceFieldName: 'uniqueWorkerId', | ||
error: 'Duplicate UNIQUEWORKERID’s are being moved to the same LOCALESTID in TRANSFERSTAFFRECORD', | ||
}), | ||
}; | ||
|
||
const addCrossValidateError = (errorsArray, errorType, JSONWorker) => { | ||
const newErrorObject = { | ||
...errorType, | ||
worker: JSONWorker.uniqueWorkerId, | ||
name: JSONWorker.localId, | ||
lineNumber: JSONWorker.lineNumber, | ||
source: JSONWorker[errorType._sourceFieldName], | ||
}; | ||
delete newErrorObject._sourceFieldName; | ||
|
||
errorsArray.unshift(newErrorObject); | ||
}; | ||
|
||
module.exports = { | ||
addCrossValidateError, | ||
MAIN_JOB_ERRORS, | ||
TRANSFER_STAFF_RECORD_ERRORS, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.