Skip to content

[Enhancement] Certificate service has a hardcoded completion check — real progress tracking not connected #761

Description

@RUKAYAT-CODER

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions