Module

Certificate Controller

This module contains the controller methods for the certificate routes.

View Source API/src/controllers/certificate.controllers.js, line 1

Requires

  • module:CertificateModel~certificateSchema
  • module:CourseReportModel~courseReportSchema
  • module:canvas

Methods

# static getAllUsersCertificates() → {Object}

Get all users certificates

View Source API/src/controllers/certificate.controllers.js, line 136

certificates

Object

# static getCertificateData(certificate_id) → {Object}

Get certificate data

Parameters:
Name Type Description
certificate_id string

Id of certificate

View Source API/src/controllers/certificate.controllers.js, line 278

if missing certificate_id

BadRequestError

if certificate not found

NotfoundError

certificate

Object

# static getCertificateForCourse(course_id) → {Object}

Get certificate for course if it exists, else create it

Parameters:
Name Type Description
course_id string

Id of course to get certificate for

View Source API/src/controllers/certificate.controllers.js, line 84

if missing param in request body

BadRequestError

if course report not found

NotFoundError

if course not completed

ForbiddenError

certificate

Object

# static issueCertificate(report_id)

Issue certificate to student

Parameters:
Name Type Description
report_id ObjectId

View Source API/src/controllers/certificate.controllers.js, line 222

if missing Course report not found

Error

if student has not completed course

Error

certificate

# static verifyCertificate(serial_number) → {Object}

Verify certificate by serial number

Parameters:
Name Type Description
serial_number string

Serial number of certificate to verify

View Source API/src/controllers/certificate.controllers.js, line 43

if missing param in request body

BadRequestError

if certificate not found

NotFoundError

certificate

Object

# async inner createCertificate(student_course_report_id, student_course_report) → {MongooseDocument}

Create certificate for student after completing a course

Parameters:
Name Type Description
student_course_report_id string

Id of student course report

student_course_report MongooseDocument

View Source API/src/controllers/certificate.controllers.js, line 161

certificate

MongooseDocument