rms-scraper
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

RMS Scraper

An abstracted library for server and client to extract student and result data from Excel worksheets( based on specified templates)

Installation

npm install rms-scraper --save

Usage

Typescript

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);

Readme

Keywords

none

Package Sidebar

Install

npm i rms-scraper

Weekly Downloads

0

Version

0.0.4

License

ISC

Unpacked Size

29.8 kB

Total Files

27

Last publish

Collaborators

  • michaeluk