An abstracted library for server and client to extract student and result data from Excel worksheets( based on specified templates)
npm install rms-scraper --save
const { studentUploadData, students } = new StudentScraper(
fileBuffer
).getStudents();
let studentsList: StudentJSON[] = [];
for (const student of students) {
const salt = await bcrypt.genSalt(10);
let password = await bcrypt.hash(student.lastName, salt);
const modeEntry = this.convertToModeOfEntry(
student.modeOfEntry.toUpperCase()
);
const isExist = await this.adminRepository.isStudentExist(student.matNo);
if (isExist) {
console.log(`Student with matric number ${student.matNo} already exist`);
continue;
}
studentsList.push({
firstName: student.firstName,
lastName: student.lastName,
middleName: null,
department: studentUploadData.department,
password: password,
email: student.email,
role: UserRole.student,
matNo: student.matNo,
jambReg: student.jambRegNo,
admissionSet: studentUploadData.studentSet,
modeOfEntry: modeEntry,
});
}
await this.adminRepository.registerStudentsfromExcelData(studentsList);