Data Layer low complexity Shared Component backend
0
Dependencies
1
Dependents
1
Entities
0
Integrations

Description

Supabase data access layer for peer mentor certification records. Stores certification type, issue date, expiry date, and renewal status. Used by the expiry checker service and coordinator roster to surface upcoming expirations.

Feature: Peer Mentor Pause & Status Management

certification-status-repository

Summaries

The Certification Status Repository ensures the organization maintains an accurate, up-to-date record of each peer mentor's training credentials. Expired certifications represent both a compliance risk and a quality risk — mentors operating beyond their certification window may not meet program standards. By reliably tracking issue dates, expiry dates, and renewal history, this component enables proactive outreach before certifications lapse, reducing program disruptions and maintaining the quality bar that families and referral partners expect. Its low complexity makes it a high-confidence, low-cost foundation for the broader certification management workflow.

This is a low-complexity data component with no external dependencies, making it one of the lowest-risk items in the delivery plan and suitable for early development to unblock dependent services. The getExpiringCertifications(beforeDate) query is the primary integration point for the nightly scheduler and expiry checker — define this interface early so those services can be developed in parallel. Testing requires seeding realistic certification records with varied expiry windows and validating that boundary date queries return correct results. No external API coordination is needed.

Recommend delivering this component in the first sprint as a foundation for downstream certification alerting features.

A straightforward Supabase repository over the certification table, exposing read and write interfaces for certification lifecycle management. getCertification(mentorId) and getExpiringCertifications(beforeDate) are the primary read paths consumed by the expiry checker service and coordinator roster UI. recordRenewal() must atomically update both renewalDate and newExpiryDate to prevent partial state writes — use a single upsert or transaction. getCertificationHistory() should return an ordered log of past certifications for audit display.

Since this component is shared across features, apply Supabase RLS at the table level and ensure all queries include coordinator_id scoping where applicable. Low complexity but high data integrity requirements given compliance implications.

Responsibilities

  • Read and update certification records for peer mentors
  • Query certifications expiring within a given date window
  • Record certification renewal events and new issue dates
  • Support coordinator-scoped certification status queries

Interfaces

getCertification(mentorId)
getExpiringCertifications(beforeDate)
updateCertificationExpiry(mentorId, newExpiryDate)
recordRenewal(mentorId, renewalDate, newExpiryDate)
getCertificationHistory(mentorId)

Relationships

Dependents (1)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/certification-statuses 10 endpoints
GET /api/v1/certification-statuses List all mentor certification statuses
GET /api/v1/certification-statuses/:mentorId Get certification status for a specific mentor
POST /api/v1/certification-statuses Create a new certification status record
PUT /api/v1/certification-statuses/:mentorId Update certification expiry date
DELETE /api/v1/certification-statuses/:mentorId Remove a certification status record
GET /api/v1/certification-renewals List all certification renewal records
+4 more