lms-sync 1.0.48 → 1.0.50

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ const Mixins = require('../utils/Mixins')
7
7
 
8
8
  const {
9
9
  AcademicDepartments,
10
+ AcademicDepartmentInstructors,
10
11
  AcademicYears,
11
12
  Campuses,
12
13
  Colleges,
@@ -22,6 +23,7 @@ const {
22
23
  Semesters,
23
24
  Employees,
24
25
 
26
+
25
27
  } = db
26
28
 
27
29
  const server = {
@@ -684,6 +686,9 @@ const server = {
684
686
 
685
687
  let employeeFind = employeeSeq.find(emps => emps.employeeNumber === _instructor?.faculty_id)
686
688
  let userFind = userSeq.find(eus => eus._id === employeeFind?.userId)
689
+ let _userFind = userSeq.find(e => e.firstName === _instructor?.first_name && e.middleName === _instructor?.middle_name && e.lastName === _instructor?.last_name)
690
+
691
+ // console.log('userFind :>> ', userFind);
687
692
 
688
693
  if(!employeeFind){}
689
694
  if(!userFind){}
@@ -723,7 +728,9 @@ const server = {
723
728
  let departmentId = _acadDepartment?._id??departmentDefault?._id
724
729
  let campusId = campusMap?._id??_campusDefault?._id
725
730
  let employeeId = employeeFind?._id??null
726
- let userId = userFind?._id??null
731
+ let userId = userFind?._id??_userFind?._id
732
+
733
+ // console.log('userId :>> ', userId);
727
734
 
728
735
  if(uEmail.has(email) && uPass.has(password) && uTPass.has(temporaryPassword) && uULname.has(lastName) && uUFname.has(firstName) && uUMname.has(middleName) && uScopes.has(adminScopes)){
729
736
  const errorMsg = `Duplicate Payload Found: [${email} - ${password} ${temporaryPassword}] - ${lastName}, ${firstName} ${middleName} ${adminScopes}`
@@ -803,7 +810,7 @@ const server = {
803
810
  migratedTable,
804
811
  // referenceId,
805
812
  isMigrated,
806
- userId,
813
+ userId: userId || null,
807
814
  employeeId,
808
815
  })
809
816
  }
@@ -825,11 +832,12 @@ const server = {
825
832
 
826
833
  if (newInstructor.length > 0) {
827
834
  // Associate userIds with new instructors
828
- newInstructor = newInstructor.map((inst, index) => ({
829
- ...inst,
830
- userId: userIds[index]
831
- }));
832
-
835
+ // if(!newInstructor.userId){
836
+ // newInstructor = newInstructor.map((inst, index) => ({
837
+ // ...inst,
838
+ // userId: userIds[index]
839
+ // }));
840
+ // }
833
841
  await Instructors.bulkCreate(newInstructor);
834
842
  createdCounter += newInstructor.length;
835
843
 
@@ -837,28 +845,16 @@ const server = {
837
845
  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
846
  });
839
847
  }
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
- // }
848
+
852
849
 
853
850
 
854
851
  console.log("");
855
852
  console.log("########################################################")
856
853
  console.log("")
857
- logger.info('User Instructors Data Creation Completed');
858
- logger.info(`Total Successful User Instructors Records Created: ${createdCounter}/${createdCounter}`);
859
- logger.info(`Total User Instructors Error Records: ${errorCounter}/${errorCounter}`);
854
+ logger.info('Instructors Data Migration Completed');
855
+ logger.info(`Total Successful Instructors Records Created: ${createdCounter}/${createdCounter}`);
856
+ logger.info(`Total Existing Instructors Records: ${errorCounter}/${errorCounter}`);
860
857
  logger.info(`Total Records: ${createdCounter + errorCounter}`);
861
-
862
858
  console.log("")
863
859
  console.log("########################################################")
864
860
  console.log("")
@@ -877,182 +873,95 @@ const server = {
877
873
  }
878
874
  },
879
875
 
880
- // async Instructorsss(){
881
- // try {
882
- // console.log("");
883
- // console.log("########################################################")
884
- // console.log(" Instructors Migration ")
885
- // console.log("########################################################")
886
- // console.log("");
887
-
888
- // const db_schema = schema
889
- // let maxIds = await Instructors.max('_id'); //Fetch maximum _id directly from the Instructors model
890
- // let maxId = maxIds|| 0;
891
- // await db.sequelize.query(`CREATE SEQUENCE IF NOT EXISTS ${db_schema}."Instructors__id_seq"`);
892
- // await db.sequelize.query(`ALTER SEQUENCE ${db_schema}."Instructors__id_seq" RESTART WITH ${maxId + 1}`);
893
-
894
- // const instructorApi = await api.Instructor()
895
- // const departmentApi = await api.Department()
896
-
897
- // const departmentSeq = await AcademicDepartments.findAll()
898
- // const campusSeq = await Campuses.findAll()
899
- // const userSeq = await Users.findAll()
900
-
901
- // const userMail = await Users.findOne({ where: { email: 'ccci_integrator@gmail.com' } });
902
- // if (!userMail){}
903
- // const campusDefault = await Campuses.findOne({ where: { name: 'Campus Default' } });
904
- // const departmentDefault = await AcademicDepartments.findOne({ where: { name: 'AcademicDepartments Default' } });
905
-
906
- // let defaultPayload = {
907
- // firstName: 'Instructor',
908
- // lastName: 'Default',
909
- // middleName: 'Migration',
910
- // employeeNumber: '_Instructor',
911
- // departmentId: departmentDefault?._id,
912
- // campusId: campusDefault?._id,
913
- // modifiedById: userMail?._id,
914
- // createdById: userMail?._id
915
- // };
876
+ async AcadDeptInstructor(){
877
+ try {
878
+ console.log("");
879
+ console.log("########################################################")
880
+ console.log(" Academic Department Instructors Migrations ")
881
+ console.log("########################################################")
882
+ console.log("");
916
883
 
917
- // let [defaults, createddef] = await Instructors.findOrCreate({
918
- // where: { employeeNumber: defaultPayload.employeeNumber, lastName: defaultPayload.lastName},
919
- // defaults: defaultPayload
920
- // });
921
-
922
- // let createdCounter = 0
923
- // let errorCounter = 0
924
- // let uniqueErrors = new Set()
884
+ const db_schema = schema
885
+ let maxIds = await AcademicDepartmentInstructors.max('_id'); //Fetch maximum _id directly from the Users model
886
+ let maxId = maxIds|| 0;
887
+ await db.sequelize.query(`CREATE SEQUENCE IF NOT EXISTS ${db_schema}."AcademicDepartmentInstructors__id_seq"`);
888
+ await db.sequelize.query(`ALTER SEQUENCE ${db_schema}."AcademicDepartmentInstructors__id_seq" RESTART WITH ${maxId + 1}`);
925
889
 
926
- // let uDept = new Set()
927
- // let uCamp = new Set()
928
- // let uLname = new Set()
929
- // let uMname = new Set()
930
- // let uFname = new Set()
931
- // let uNum = new Set()
890
+ const instructorApi = await api.Instructor()
932
891
 
933
- // let newInstructor = []
892
+ const instructorSeq = await Instructors.findAll()
893
+ const departmentSeq = await AcademicDepartments.findAll()
934
894
 
935
- // const exInst = await Instructors.findAll()
936
- // const exInstMap = new Map(exInst.map(inst => [`[${inst.employeeNumber}] - ${inst.lastName}, ${inst.firstName} ${inst.middleName} [${inst.departmentId}, ${inst.campusId}]` , inst]))
895
+ const userMail = await Users.findOne({ where: { email: 'ccci_integrator@gmail.com' } });
896
+ if (!userMail){}
937
897
 
898
+ let createdCounter = 0
899
+ let errorCounter = 0
900
+ let uniqueErrors = new Set()
938
901
 
939
- // for (let i = 0; i < instructorApi.length; i++){
940
- // try {
941
-
942
- // let _instructor = instructorApi[i]
943
-
944
- // let findUser = await userSeq.find( f => f.lastName === _instructor?.last_name && f.firstName === _instructor?.first_name && f.middleName === _instructor?.middle_name)
902
+ for(let i = 0; i < instructorApi.length; i++){
903
+ try {
904
+ let instructor = instructorApi[i]
905
+
906
+ let _instructor = instructorSeq.find(num => num.employeeNumber === instructor?.faculty_id)
907
+ let _department = departmentSeq.find(dep => dep._id === _instructor?.departmentId)
908
+
909
+ let modifiedById = userMail._id
910
+ let createdById = userMail._id
911
+
912
+ let [record, created] = await AcademicDepartmentInstructors.findOrCreate({
913
+ where:{
914
+ instructorId: _instructor?._id,
915
+ academicDepartmentId: _department?._id,
916
+ },
917
+ defaults:{
918
+ instructorId: _instructor?._id,
919
+ academicDepartmentId: _department?._id,
920
+ modifiedById,
921
+ createdById
922
+ }
923
+ })
924
+ if (created){
925
+ logger.info(`${createdCounter + 1}/${createdCounter + 1} New Academic Department Instructor Record Created: instructorId: ${record.instructorId}, academicDepartmentId: ${record.academicDepartmentId} `)
926
+ createdCounter++;
927
+ }
928
+ else {
929
+ const errorMsg = `Academic Department Instructor Record Already Exists: instructorId: ${record.instructorId}, academicDepartmentId: ${record.academicDepartmentId}`;
945
930
 
946
- // let acadDepartmentMap = departmentApi.find(a => a.name === _instructor?.department_name)
947
- // let _acadDepartment = departmentSeq.find(b => b.name === acadDepartmentMap?.name)
948
- // let campusMap = campusSeq.find(c => c._id === _acadDepartment?.campusId)
949
-
950
- // let modifiedById = userMail?._id
951
- // let createdById = userMail?._id
931
+ if (!uniqueErrors.has(errorMsg)) {
932
+ logger.error(`${errorCounter + 1}/${errorCounter + 1} ${errorMsg}`);
933
+ uniqueErrors.add(errorMsg);
934
+ errorCounter++;
935
+ }
952
936
 
953
- // let campusDefault = "MSC - Boac Campus"
954
- // let _campusDefault = campusSeq.find(ccc => ccc.name === campusDefault)
937
+ }
938
+ } catch (error) {
939
+ logger.error(`Error occurred: ${error} ${error.stack}`);
940
+ }
941
+ }
942
+ let items = createdCounter + errorCounter
943
+ console.log("");
944
+ console.log("########################################################")
945
+ console.log("")
946
+ logger.info('Academic Department Instructors Data Migration Completed');
947
+ logger.info(`Total Successful Records Created: ${createdCounter}/${createdCounter}`);
948
+ logger.info(`Total Existing Records: ${errorCounter}/${errorCounter}`);
949
+ logger.info(`Total Record Fetched: ${items} `)
950
+ console.log("")
951
+ console.log("########################################################")
952
+ console.log("")
955
953
 
956
- // let role = _instructor?.role
957
- // let isChairPerson = false
958
- // let isDean = false
959
-
960
- // if(role === "Program Chair"){
961
- // isChairPerson = true
962
- // }
963
- // if(role === "Dean"){
964
- // isDean = true
965
- // }
966
-
967
- // let firstName = _instructor?.first_name
968
- // let lastName = _instructor?.last_name
969
- // let middleName = _instructor?.middle_name
970
- // let employeeNumber = _instructor?.faculty_id
971
- // let departmentId = _acadDepartment?._id??departmentDefault?._id
972
- // let campusId = campusMap?._id??_campusDefault?._id
973
- // let userId = findUser?._id
974
-
975
- // if(uNum.has(employeeNumber) && uLname.has(lastName) && uFname.has(firstName) && uMname.has(middleName) && uDept.has(departmentId) && uCamp.has(campusId)){
976
- // const errorMsg = `Duplicate Payload Found: [${employeeNumber}] - ${lastName}, ${firstName} ${middleName} [departmentId: ${departmentId}, campusId:${campusId}]`
977
- // if(!uniqueErrors.has(errorMsg)){
978
- // logger.error(`${errorCounter + 1}/${errorCounter + 1}: ${errorMsg}`)
979
- // uniqueErrors.add(errorMsg)
980
- // errorCounter++
981
- // }
982
- // }
983
- // else if ( exInstMap.has(`[${employeeNumber}] - ${lastName}, ${firstName} ${middleName} [${departmentId}, ${campusId}]`)){
984
- // const exInst = exInstMap.get(`[${employeeNumber}] - ${lastName}, ${firstName} ${middleName} [${departmentId}, ${campusId}]`)
985
- // const errorMsg = `Existing Data Found:[${exInst.employeeNumber}] - ${exInst.lastName}, ${exInst.firstName} ${exInst.middleName} [departmentId: ${exInst.departmentId}, campusId: ${exInst.campusId}]`
986
- // if(!uniqueErrors.has(errorMsg)){
987
- // logger.error(`${errorCounter + 1}/${errorCounter + 1}: ${errorMsg}`)
988
- // uniqueErrors.add(errorMsg)
989
- // errorCounter++
990
- // }
991
- // }
992
- // else{
993
- // uNum.add(employeeNumber)
994
- // uLname.add(lastName)
995
- // uFname.add(firstName)
996
- // uMname.add(middleName)
997
- // uDept.add(departmentId)
998
- // uCamp.add(campusId)
999
- // newInstructor.push({
1000
- // firstName: _instructor?.first_name,
1001
- // lastName: _instructor?.last_name,
1002
- // middleName: _instructor?.middle_name,
1003
- // employeeNumber: _instructor?.faculty_id,
1004
- // departmentId: _acadDepartment?._id??departmentDefault?._id,
1005
- // academicDepartmentId: _acadDepartment?._id??departmentDefault?._id,
1006
- // campusId: campusMap?._id??_campusDefault?._id??campusDefault?._id,
1007
- // isDean,
1008
- // isChairPerson,
1009
- // modifiedById,
1010
- // createdById,
1011
- // userId
1012
- // })
1013
- // }
1014
-
1015
- // } catch (error) {
1016
- // logger.error(`Error occurred: ${error} ${error.stack}`);
1017
- // }
1018
- // }
954
+ let totalSummary = {
955
+ itemLength: items,
956
+ error: errorCounter,
957
+ success: createdCounter
958
+ }
959
+ return totalSummary
1019
960
 
1020
- // if (newInstructor.length > 0) {
1021
-
1022
- // await Instructors.bulkCreate(newInstructor)
1023
- // createdCounter += newInstructor.length
1024
-
1025
- // newInstructor.forEach((inst, index) => {
1026
- // logger.info(`${index + 1}/${index + 1}: New Instructor Record Created: [${inst.employeeNumber}] - ${inst.lastName}, ${inst.firstName} ${inst.middleName} [ departmentId: ${inst.departmentId}, campusId: ${inst.campusId}]`)
1027
- // });
1028
-
1029
- // }
1030
-
1031
- // console.log("");
1032
- // console.log("########################################################")
1033
- // console.log("")
1034
- // logger.info('Instructors Data Migration Completed');
1035
- // logger.info(`Total Successful Instructors Records Created: ${createdCounter}/${createdCounter}`);
1036
- // logger.info(`Total Existing Instructors Records: ${errorCounter}/${errorCounter}`);
1037
- // logger.info(`Total Records: ${createdCounter + errorCounter}`);
1038
-
1039
- // console.log("")
1040
- // console.log("########################################################")
1041
- // console.log("")
1042
-
1043
- // let totalSummary = {
1044
- // itemLength: createdCounter + errorCounter,
1045
- // error: errorCounter,
1046
- // success: createdCounter
1047
- // }
1048
- // return totalSummary
1049
-
1050
- // } catch (error) {
1051
- // ;
1052
- // logger.error(`Error occurred: ${error} ${error.stack} `);
1053
-
1054
- // }
1055
- // },
961
+ } catch (error) {
962
+ logger.error(`Error occurred: ${error} ${error.stack}`);
963
+ }
964
+ },
1056
965
 
1057
966
  async Course(){
1058
967
  try {
@@ -1671,6 +1580,9 @@ const server = {
1671
1580
 
1672
1581
  async Schedule(){
1673
1582
  try {
1583
+
1584
+ await db.sequelize.query('DROP FUNCTION IF EXISTS pg_temp.testfunc()');
1585
+
1674
1586
  console.log("");
1675
1587
  console.log("########################################################")
1676
1588
  console.log(" Schedules Migration ")
@@ -1682,7 +1594,8 @@ const server = {
1682
1594
  let maxId = maxIds|| 0;
1683
1595
  await db.sequelize.query(`CREATE SEQUENCE IF NOT EXISTS ${db_schema}."Schedules__id_seq"`);
1684
1596
  await db.sequelize.query(`ALTER SEQUENCE ${db_schema}."Schedules__id_seq" RESTART WITH ${maxId + 1}`);
1685
-
1597
+ await db.sequelize.query(`DROP FUNCTION IF EXISTS ${db_schema}."pg_temp.testfunc()"`);
1598
+
1686
1599
  const scheduleApi = await api.Schedule()
1687
1600
  const userMail = await Users.findOne({ where: { email: 'ccci_integrator@gmail.com' } });
1688
1601
 
@@ -2074,167 +1987,6 @@ const server = {
2074
1987
  }
2075
1988
  },
2076
1989
 
2077
- // async Studentsss(){
2078
- // try {
2079
- // console.log("");
2080
- // console.log("########################################################")
2081
- // console.log(" Students Migration ")
2082
- // console.log("########################################################")
2083
- // console.log("");
2084
-
2085
- // const db_schema = schema
2086
- // let maxIds = await Students.max('_id'); // Fetch maximum _id directly from the Students model
2087
- // let maxId = maxIds|| 0;
2088
- // await db.sequelize.query(`CREATE SEQUENCE IF NOT EXISTS ${db_schema}."Students__id_seq"`);
2089
- // await db.sequelize.query(`ALTER SEQUENCE ${db_schema}."Students__id_seq" RESTART WITH ${maxId + 1}`);
2090
-
2091
- // const studentApi = await api.Student()
2092
-
2093
- // const campusSeq = await Campuses.findAll()
2094
- // const courseSeq = await Courses.findAll()
2095
- // const collegeSeq = await Colleges.findAll()
2096
- // const semesterSeq = await Semesters.findAll()
2097
- // const acadYearSeq = await AcademicYears.findAll()
2098
- // const userSeq = await Users.findAll()
2099
-
2100
- // const userMail = await Users.findOne({ where: { email: 'ccci_integrator@gmail.com' } });
2101
- // const campusDefault = await Campuses.findOne({ where: { name: 'Campus Default' } });
2102
- // const courseDefault = await Courses.findOne({ where: { name: 'Course Default' } });
2103
- // const collegeDefault = await Colleges.findOne({ where: { name: 'Colleges Default' } });
2104
-
2105
- // let createdCounter = 0
2106
- // let errorCounter = 0
2107
- // let uniqueErrors = new Set()
2108
-
2109
- // let uNum = new Set()
2110
- // let uLname = new Set()
2111
- // let uMname = new Set()
2112
- // let uFname = new Set()
2113
- // let uCourse = new Set()
2114
- // let uCampus = new Set()
2115
-
2116
- // let newStudent = []
2117
-
2118
- // const exStudent = await Students.findAll()
2119
- // const exStudentMap = new Map(exStudent.map(student => [`[${student.studentNumber}] - ${student.lastName}, ${student.firstName} ${student.middleName} [${student.courseId}, ${student.campusId}]`, student]))
2120
-
2121
- // const {data} = studentApi
2122
-
2123
- // for (let i = 0; i < data.length; i++){
2124
- // try {
2125
- // let _student = data[i]
2126
-
2127
- // let _campus = campusSeq.find(a => a.name === _student?.campus)
2128
- // let _course = courseSeq.find(b => b.name === _student?.course)
2129
- // let _college = collegeSeq.find(c => c.name === _student?.college)
2130
-
2131
- // let findUser = await userSeq.find( f => f.lastName === _student?.last_name && f.firstName === _student?.first_name && f.middleName === _student?.middle_name)
2132
-
2133
- // let modifiedById = userMail?._id
2134
- // let createdById = userMail?._id
2135
-
2136
- // let fromPrompts = await Picked()
2137
-
2138
- // // let semester = "2nd Semester"
2139
- // let semester = fromPrompts.semester
2140
- // let yearsFrom = fromPrompts.yearFrom
2141
- // let yearsTo = fromPrompts.yearTo
2142
-
2143
- // let _semester = semesterSeq.find(sem => sem.code === semester)
2144
- // let _acadYear = acadYearSeq.find(yr => yr.from === parseInt(yearsFrom) && yr.to === parseInt(yearsTo))
2145
-
2146
- // let studentNumber = _student?.student_number
2147
- // let firstName = _student?.first_name
2148
- // let lastName = _student?.last_name
2149
- // let middleName = _student?.middle_name
2150
- // let courseId = _course?._id??courseDefault?._id
2151
- // let campusId = _campus?._id??campusDefault?._id
2152
-
2153
- // let getUserName = Mixins.generateUsername(firstName, lastName)
2154
- // let email = `${getUserName}@msumarinduque.edu.ph`
2155
-
2156
- // let userId = findUser?._id
2157
-
2158
-
2159
- // if(uNum.has(studentNumber) && uLname.has(lastName) && uFname.has(firstName) && uMname.has(middleName) && uCourse.has(courseId) && uCampus.has(campusId)){
2160
- // const errorMsg = `Duplicate Payload Found: [${studentNumber}] - ${lastName}, ${firstName} ${middleName} [courseId: ${courseId}, campusId:${campusId}]`
2161
- // if(!uniqueErrors.has(errorMsg)){
2162
- // logger.error(`${errorCounter + 1}/${errorCounter + 1}: ${errorMsg}`)
2163
- // uniqueErrors.add(errorMsg)
2164
- // errorCounter++
2165
- // }
2166
- // }
2167
- // else if ( exStudentMap.has(`[${studentNumber}] - ${lastName}, ${firstName} ${middleName} [${courseId}, ${campusId}]`)){
2168
- // const exStudent = exStudentMap.get(`[${studentNumber}] - ${lastName}, ${firstName} ${middleName} [${courseId}, ${campusId}]`)
2169
- // const errorMsg = `Existing Data Found:[${exStudent.studentNumber}] - ${exStudent.lastName}, ${exStudent.firstName} ${exStudent.middleName} [courseId: ${exStudent.courseId}, campusId: ${exStudent.campusId}]`
2170
- // if(!uniqueErrors.has(errorMsg)){
2171
- // logger.error(`${errorCounter + 1}/${errorCounter + 1}: ${errorMsg}`)
2172
- // uniqueErrors.add(errorMsg)
2173
- // errorCounter++
2174
- // }
2175
- // }
2176
- // else{
2177
- // uNum.add(studentNumber)
2178
- // uLname.add(lastName)
2179
- // uMname.add(middleName)
2180
- // uFname.add(firstName)
2181
- // uCourse.add(courseId)
2182
- // uCampus.add(campusId)
2183
- // newStudent.push({
2184
- // studentNumber: _student?.student_number,
2185
- // firstName: _student?.first_name,
2186
- // lastName: _student?.last_name,
2187
- // middleName: _student?.middle_name,
2188
- // email: email,
2189
- // courseId: _course?._id??courseDefault?._id,
2190
- // campusId: _campus?._id??campusDefault?._id,
2191
- // collegeId: _college?._id??collegeDefault?._id,
2192
- // admittedYearId: _acadYear?._id ?? null,
2193
- // admittedSemId: _semester?._id ?? null,
2194
- // modifiedById,
2195
- // createdById,
2196
- // userId
2197
- // })
2198
- // }
2199
-
2200
- // } catch (error) {
2201
- // logger.error(`Error occurred: ${error.stack} ${error}`);
2202
- // }
2203
- // }
2204
-
2205
- // if (newStudent.length > 0) {
2206
- // await Students.bulkCreate(newStudent)
2207
- // createdCounter += newStudent.length
2208
-
2209
- // newStudent.forEach((exStudent, index) => {
2210
- // logger.info(`${index + 1}/${index + 1}: New Student Record Created: [${exStudent.studentNumber}] - ${exStudent.lastName}, ${exStudent.firstName} ${exStudent.middleName} [courseId: ${exStudent.courseId}, campusId: ${exStudent.campusId}]`)
2211
- // });
2212
- // }
2213
-
2214
- // console.log("");
2215
- // console.log("########################################################")
2216
- // console.log("")
2217
- // logger.info('Student Data Migration Completed');
2218
- // logger.info(`Total Successful Student Records Created: ${createdCounter}/${createdCounter}`);
2219
- // logger.info(`Total Existing Student Records: ${errorCounter}/${errorCounter}`);
2220
- // logger.info(`Total Records: ${createdCounter + errorCounter}`);
2221
- // console.log("")
2222
- // console.log("########################################################")
2223
- // console.log("")
2224
-
2225
- // let totalSummary = {
2226
- // itemLength: createdCounter + errorCounter,
2227
- // error: errorCounter,
2228
- // success: createdCounter
2229
- // }
2230
- // return totalSummary
2231
-
2232
- // } catch (error) {
2233
- // logger.error(`Error occurred: ${error.stack} ${error}`);
2234
-
2235
- // }
2236
- // },
2237
-
2238
1990
  async Section() {
2239
1991
  try {
2240
1992
  console.log("");
@@ -2451,7 +2203,6 @@ const server = {
2451
2203
  }
2452
2204
  },
2453
2205
 
2454
-
2455
2206
  async EnrolledStudent(){
2456
2207
  try {
2457
2208
  console.log("");
@@ -2704,6 +2455,7 @@ module.exports = {
2704
2455
  Course: server.Course,
2705
2456
  Room: server.Room,
2706
2457
  Instructor: server.Instructor,
2458
+ AcadDeptInstructor: server.AcadDeptInstructor,
2707
2459
  AcademicYear: server.AcademicYear,
2708
2460
  Subject: server.Subject,
2709
2461
  Schedule: server.Schedule,
@@ -14,8 +14,8 @@ async function promptYearSem() {
14
14
  { title: 'Campus', value: 'Campus' },
15
15
  { title: 'College', value: 'College' },
16
16
  { title: 'AcademicDepartments', value: 'AcademicDepartments' },
17
- // { title: 'UserInstructor', value: 'UserInstructor' },
18
17
  { title: 'Instructor', value: 'Instructor' },
18
+ { title: 'Academic Department Instructors', value: 'AcadDeptInstructor' },
19
19
  { title: 'Course', value: 'Course' },
20
20
  { title: 'Room', value: 'Room' },
21
21
  { title: 'AcademicYear', value: 'AcademicYear' },
package/login.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "email": "ictsc@mscmarinduque.edu.ph",
3
+ "password": "MjU8qweXLaFpDnEyfRrbY9",
4
+ "baseURL": "https://lms.api.msc.priisms.online/api"
5
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+
4
+ module.exports = (sequelize, DataTypes,schema) => {
5
+
6
+ const AcademicDepartmentInstructors = sequelize.define('AcademicDepartmentInstructors',
7
+ {
8
+ instructorId: {
9
+ type: DataTypes.INTEGER,
10
+ allowNull: false
11
+ },
12
+ academicDepartmentId: {
13
+ type: DataTypes.INTEGER,
14
+ allowNull: false
15
+ },
16
+ isActive: {
17
+ type: DataTypes.BOOLEAN,
18
+ unique: false,
19
+ allowNull: true,
20
+ autoIncrement: false,
21
+ primaryKey: false,
22
+ defaultValue: true,
23
+ },
24
+ _id: {
25
+ type: DataTypes.INTEGER,
26
+ unique: true,
27
+ allowNull: false,
28
+ autoIncrement: true,
29
+ primaryKey: true,
30
+ },
31
+ createdById: {
32
+ type: DataTypes.INTEGER,
33
+ unique: false,
34
+ allowNull: true,
35
+ autoIncrement: false,
36
+ primaryKey: false,
37
+ },
38
+ modifiedById: {
39
+ type: DataTypes.INTEGER,
40
+ unique: false,
41
+ allowNull: true,
42
+ autoIncrement: false,
43
+ primaryKey: false,
44
+ },
45
+ },
46
+ {
47
+ sequelize,
48
+ schema,
49
+ modelName: "AcademicDepartmentInstructors",
50
+ }
51
+ );
52
+
53
+
54
+ return AcademicDepartmentInstructors;
55
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lms-sync",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "Migration App for MSC LMS",
5
5
  "main": "index.js",
6
6
  "scripts": {