lms-sync 1.0.48 → 1.0.49
Sign up to get free protection for your applications and to get access to all the features.
- package/apiConnections/mapping.js +22 -23
- package/package.json +1 -1
@@ -684,6 +684,9 @@ const server = {
|
|
684
684
|
|
685
685
|
let employeeFind = employeeSeq.find(emps => emps.employeeNumber === _instructor?.faculty_id)
|
686
686
|
let userFind = userSeq.find(eus => eus._id === employeeFind?.userId)
|
687
|
+
let _userFind = userSeq.find(e => e.firstName === _instructor?.first_name && e.middleName === _instructor?.middle_name && e.lastName === _instructor?.last_name)
|
688
|
+
|
689
|
+
// console.log('userFind :>> ', userFind);
|
687
690
|
|
688
691
|
if(!employeeFind){}
|
689
692
|
if(!userFind){}
|
@@ -723,7 +726,9 @@ const server = {
|
|
723
726
|
let departmentId = _acadDepartment?._id??departmentDefault?._id
|
724
727
|
let campusId = campusMap?._id??_campusDefault?._id
|
725
728
|
let employeeId = employeeFind?._id??null
|
726
|
-
let userId = userFind?._id??
|
729
|
+
let userId = userFind?._id??_userFind?._id
|
730
|
+
|
731
|
+
// console.log('userId :>> ', userId);
|
727
732
|
|
728
733
|
if(uEmail.has(email) && uPass.has(password) && uTPass.has(temporaryPassword) && uULname.has(lastName) && uUFname.has(firstName) && uUMname.has(middleName) && uScopes.has(adminScopes)){
|
729
734
|
const errorMsg = `Duplicate Payload Found: [${email} - ${password} ${temporaryPassword}] - ${lastName}, ${firstName} ${middleName} ${adminScopes}`
|
@@ -803,7 +808,7 @@ const server = {
|
|
803
808
|
migratedTable,
|
804
809
|
// referenceId,
|
805
810
|
isMigrated,
|
806
|
-
userId,
|
811
|
+
userId: userId || null,
|
807
812
|
employeeId,
|
808
813
|
})
|
809
814
|
}
|
@@ -825,11 +830,12 @@ const server = {
|
|
825
830
|
|
826
831
|
if (newInstructor.length > 0) {
|
827
832
|
// Associate userIds with new instructors
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
+
// if(!newInstructor.userId){
|
834
|
+
// newInstructor = newInstructor.map((inst, index) => ({
|
835
|
+
// ...inst,
|
836
|
+
// userId: userIds[index]
|
837
|
+
// }));
|
838
|
+
// }
|
833
839
|
await Instructors.bulkCreate(newInstructor);
|
834
840
|
createdCounter += newInstructor.length;
|
835
841
|
|
@@ -837,26 +843,15 @@ const server = {
|
|
837
843
|
logger.info(`${index + 1}/${index + 1}: New Instructor Record Created: [${inst.employeeNumber}] - ${inst.lastName}, ${inst.firstName} ${inst.middleName} [ departmentId: ${inst.departmentId}, campusId: ${inst.campusId}]`);
|
838
844
|
});
|
839
845
|
}
|
840
|
-
|
841
|
-
|
842
|
-
// if (newInstructor.length > 0) {
|
843
|
-
|
844
|
-
// await Instructors.bulkCreate(newInstructor)
|
845
|
-
// createdCounter += newInstructor.length
|
846
|
-
|
847
|
-
// newInstructor.forEach((inst, index) => {
|
848
|
-
// logger.info(`${index + 1}/${index + 1}: New Instructor Record Created: [${inst.employeeNumber}] - ${inst.lastName}, ${inst.firstName} ${inst.middleName} [ departmentId: ${inst.departmentId}, campusId: ${inst.campusId}]`)
|
849
|
-
// });
|
850
|
-
|
851
|
-
// }
|
846
|
+
|
852
847
|
|
853
848
|
|
854
849
|
console.log("");
|
855
850
|
console.log("########################################################")
|
856
851
|
console.log("")
|
857
|
-
logger.info('
|
858
|
-
logger.info(`Total Successful
|
859
|
-
logger.info(`Total
|
852
|
+
logger.info('Instructors Data Migration Completed');
|
853
|
+
logger.info(`Total Successful Instructors Records Created: ${createdCounter}/${createdCounter}`);
|
854
|
+
logger.info(`Total Existing Instructors Records: ${errorCounter}/${errorCounter}`);
|
860
855
|
logger.info(`Total Records: ${createdCounter + errorCounter}`);
|
861
856
|
|
862
857
|
console.log("")
|
@@ -1671,6 +1666,9 @@ const server = {
|
|
1671
1666
|
|
1672
1667
|
async Schedule(){
|
1673
1668
|
try {
|
1669
|
+
|
1670
|
+
await db.sequelize.query('DROP FUNCTION IF EXISTS pg_temp.testfunc()');
|
1671
|
+
|
1674
1672
|
console.log("");
|
1675
1673
|
console.log("########################################################")
|
1676
1674
|
console.log(" Schedules Migration ")
|
@@ -1682,7 +1680,8 @@ const server = {
|
|
1682
1680
|
let maxId = maxIds|| 0;
|
1683
1681
|
await db.sequelize.query(`CREATE SEQUENCE IF NOT EXISTS ${db_schema}."Schedules__id_seq"`);
|
1684
1682
|
await db.sequelize.query(`ALTER SEQUENCE ${db_schema}."Schedules__id_seq" RESTART WITH ${maxId + 1}`);
|
1685
|
-
|
1683
|
+
await db.sequelize.query(`DROP FUNCTION IF EXISTS ${db_schema}."pg_temp.testfunc()"`);
|
1684
|
+
|
1686
1685
|
const scheduleApi = await api.Schedule()
|
1687
1686
|
const userMail = await Users.findOne({ where: { email: 'ccci_integrator@gmail.com' } });
|
1688
1687
|
|