Certification Record Repository
Component Detail
Description
Data access layer for HLF certification records stored in Supabase. Fetches certification expiry dates, completion history, and linked course enrollment records for a given peer mentor. Returns null gracefully for non-HLF organizations that have no certification data.
certification-record-repository
Summaries
The Certification Record Repository safeguards the integrity of HLF training compliance data that organizations rely on to verify mentor qualifications. By providing a clean, typed interface to certification history and expiry records, it enables administrators to audit mentor credentials at any time and supports automated compliance workflows that flag expiring certifications before they lapse. The graceful null return for non-HLF organizations ensures the system remains broadly usable without requiring certification infrastructure from all partners, lowering the barrier to adoption and enabling phased rollout of compliance features to new organizational clients.
Low complexity with a single dependency on supabase-client-provider. Straightforward to deliver early and independently of other feature work. Key QA scenarios include null return for non-HLF organizations, correct ordering of getLatestCertification when multiple records exist, and full CRUD coverage for saveCertificationRecord and deleteCertificationRecord. Coordinate with the HLF organization stakeholder to confirm the Supabase table structure and whether certification records are soft- or hard-deleted — this affects the deleteCertificationRecord implementation and audit display logic.
No mobile-specific concerns beyond standard Supabase client configuration already handled by the shared provider.
Uses supabase-client-provider to query the certifications table scoped by mentor_id. getLatestCertification orders by expiry_date descending with a limit of 1 and returns null if no rows exist (covers non-HLF orgs). getCertificationHistory returns all records ordered by expiry_date descending for audit list display. CertificationRecord is an immutable Dart model with fromJson deserialization including nullable expiry_date field.
saveCertificationRecord uses Supabase upsert keyed on record ID; deleteCertificationRecord uses .delete().eq('id', recordId). No realtime subscription needed here — certification data changes infrequently and is refreshed on-demand via the aggregation service. Keep HLF-specific business rules (status derivation, suppression logic) out of this layer and inside CertificationStatusService.
Responsibilities
- Fetch latest certification record for a peer mentor by ID
- Return null for organizations without certification requirements
- List all certification history entries for audit display
- Map Supabase response to typed CertificationRecord Dart model
Interfaces
getLatestCertification(String mentorId)
getCertificationHistory(String mentorId)
saveCertificationRecord(CertificationRecord record)
deleteCertificationRecord(String recordId)
Relationships
Dependencies (1)
Components this component depends on
Dependents (2)
Components that depend on this component
Related Data Entities (1)
Data entities managed by this component