This module contains the controller methods for the certificate routes.
Requires
- module:CertificateModel~certificateSchema
- module:CourseReportModel~courseReportSchema
- module:canvas
Methods
# static getCertificateData(certificate_id) → {Object}
Get certificate data
Parameters:
Name | Type | Description |
---|---|---|
certificate_id |
string
|
Id of certificate |
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 |
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
|
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 |
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
|
certificate
MongooseDocument