Data Layer low complexity backend
0
Dependencies
4
Dependents
0
Entities
0
Integrations

Description

Repository adapter for the certificates table. Manages certificate CRUD operations and provides query methods used by both the mobile service layer and admin backend.

Feature: Digital Peer Mentor Certificate

certificates-table

Responsibilities

  • Insert a new certificate record linked to a completed course enrollment
  • Query the active certificate for a given user ID
  • Update expiry date on certificate extension
  • Mark certificate as revoked with timestamp and reason
  • Query certificates expiring within a given number of days for the background job

Interfaces

insertCertificate(data: CertificateInsert): Promise<Certificate>
getCertificateByUserId(userId: string): Promise<Certificate | null>
updateExpiry(certificateId: string, newExpiry: Date): Promise<void>
revokeCertificate(certificateId: string, reason: string): Promise<void>
findExpiringWithinDays(days: number): Promise<Certificate[]>