Skip to content

feat(academy): certification eligibility checks (BE-042) - #900

Merged
MaryammAli merged 2 commits into
BlockDash-Studios:mainfrom
AKAEMM668:fix/be-042-certification-eligibility-checks
Sep 27, 2026
Merged

MaryammAli merged 2 commits into
BlockDash-Studios:mainfrom
AKAEMM668:fix/be-042-certification-eligibility-checks

Conversation

@AKAEMM668

Copy link
Copy Markdown
Contributor

Overview

Implements BE-042 certification eligibility checks for BackendAcademy. Adds a service that decides whether a learner qualifies for a certificate_nft mint: every task the course requires must be graded, and every recorded score must meet the course minimum ("all tasks passed, min score"). It exposes the eligibility endpoint(s) the certificate minting job consults before calling the Soroban mint_certificate entry point.

Related Issue

Closes #795

Changes

🎓 Certification eligibility module

  • [ADD] BackendAcademy/src/certificates/certificates.types.ts — criteria, task-result and eligibility types. The minimum score defaults to the grading pipeline's pass threshold, so "passed" means the same thing across the academy.
  • [ADD] BackendAcademy/src/certificates/certificates.service.ts — the eligibility oracle: registers per-course criteria, records the learner's best final score per task (a retake can lift a task but never lower a certificate), computes the verdict with human-readable reasons plus a finalScore for the mint, and lists every learner a course may mint for.
  • [ADD] BackendAcademy/src/certificates/certificates.controller.ts — REST surface under api/v1/certificates:
    • POST /courses — register the required task ids + minimum score.
    • POST /results — record a learner's final task score from the grading pipeline.
    • GET /users/:userId/courses/:courseId/eligibility — the eligibility verdict used by the certificate minting job.
    • GET /courses/:courseId/eligible-learners — batch list for the job.
  • [ADD] BackendAcademy/src/certificates/dto/* — validated request DTOs.
  • [ADD] BackendAcademy/src/certificates/certificates.module.ts — module wiring; the service is exported for an in-process minting job.
  • [MODIFY] BackendAcademy/src/app.module.ts — register CertificatesModule.
  • [MODIFY] BackendAcademy/README.md — document the BE-042 endpoints.

🧪 Tests

  • [ADD] BackendAcademy/src/certificates/certificates.service.spec.ts — unit coverage for criteria validation, best-score retention, missing/failing/eligible verdicts, and the batch view.
  • [ADD] BackendAcademy/test/certificates.e2e-spec.ts — HTTP register → record → eligibility → eligible-learners flow.

Verification Results

pnpm test -- --runInBand
PASS src/certificates/certificates.service.spec.ts
Tests:       138 passed, 138 total

pnpm test:e2e -- --testPathPattern certificates --runInBand
PASS test/certificates.e2e-spec.ts
Tests:       2 passed, 2 total

Note: origin/main already fails a full pnpm type-check because of pre-existing, unrelated issues (a corrupted src/courses/courses.module.ts, TooManyRequestsException imports, and Horizon asset_code typings). This PR does not touch those files; the new module compiles and its tests pass in isolation.

Acceptance Criteria

Criteria Status
Eligibility endpoint used by the certificate minting job ✅ GET /api/v1/certificates/users/:userId/courses/:courseId/eligibility, plus GET /api/v1/certificates/courses/:courseId/eligible-learners
All tasks passed ✅ Eligible only when every required task has a recorded result
Minimum score ✅ Each task score must be ≥ the course minimum (defaults to the grading pass threshold, 60)

Add a CertificatesService that decides whether a learner qualifies for a certificate_nft mint: every required task must have a graded final score and each must meet the course minimum. Expose the eligibility endpoints the certificate minting job consults, plus specs.
@drips-wave

drips-wave Bot commented Sep 27, 2026

Copy link
Copy Markdown

@AKAEMM668 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@MaryammAli MaryammAli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MaryammAli
MaryammAli merged commit 1721b0a into BlockDash-Studios:main Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BE-042 — Certification eligibility checks

2 participants