Overview
src/services/certificate-service.ts contains a TODO comment at line 41 noting that course completion validation needs to be connected to the actual progress tracking system. Currently, certificate generation may succeed regardless of whether the user has actually completed the course, undermining the certificate's credibility.
Specifications
Features:
- Certificate issuance is gated on verified course completion from the progress tracking system
- Users who have not completed the course receive HTTP 403 with a clear message
Tasks:
- Query the
user_progress table for the requesting user and the target course
- Assert that
progress >= 100 (or all required lessons are marked complete) before generating the certificate
- Return HTTP 403 with
{ error: 'Course not completed' } if the check fails
- Add tests covering the incomplete-course rejection case
Impacted Files:
src/services/certificate-service.ts
src/app/api/certificates/generate/route.ts
Acceptance Criteria
- Certificate generation fails with HTTP 403 if course completion is below 100%
- Certificate generates successfully when progress is complete
- No hardcoded completion bypass remains
Overview
src/services/certificate-service.tscontains a TODO comment at line 41 noting that course completion validation needs to be connected to the actual progress tracking system. Currently, certificate generation may succeed regardless of whether the user has actually completed the course, undermining the certificate's credibility.Specifications
Features:
Tasks:
user_progresstable for the requesting user and the target courseprogress >= 100(or all required lessons are marked complete) before generating the certificate{ error: 'Course not completed' }if the check failsImpacted Files:
src/services/certificate-service.tssrc/app/api/certificates/generate/route.tsAcceptance Criteria