Infrastructure medium complexity backend
1
Dependencies
0
Dependents
2
Entities
0
Integrations

Description

Supabase Edge Function or scheduled PostgreSQL job that runs periodically to detect peer mentors whose certifications have expired and automatically sets their status to paused. Specific to HLF, where an expired certificate must remove the mentor from the public chapter website listing. Triggers coordinator notifications via the notification service.

Feature: Peer Mentor Pause & Reactivation

certification-expiry-job

Summaries

The Certification Expiry Auto-Pause Job protects your organization's credibility and legal standing by automatically removing uncertified mentors from active duty and from public-facing chapter website listings. For HLF specifically, displaying an expired mentor undermines trust with prospective participants and could expose the organization to reputational or compliance risk. By automating this enforcement, coordinators no longer need to manually track certificate expiry dates, reducing administrative overhead and eliminating the human error risk of an expired mentor remaining visible and assignable. This is a key trust and compliance feature that directly supports organizational integrity.

This is a medium-complexity backend job with a clear HLF-specific scope. Delivery depends on the mentor-status-repository being stable and the notification service being available to receive coordinator alerts. The job must be implemented as either a Supabase Edge Function or a scheduled PostgreSQL cron job — this architectural decision should be made early and documented, as it affects deployment, monitoring, and retry strategies. Plan for thorough testing of edge cases: mentors with multiple certifications, mentors already paused for other reasons, and notification failures.

Estimate 5–7 days including scheduling configuration, error logging, and QA. Coordinate with the HLF product owner on the exact expiry detection logic.

This backend job runs on a configurable schedule (cron or Supabase Edge Function trigger) and queries the peer_mentors table for records where certification_expiry is in the past and status is not already paused. It calls mentor-status-repository.updateStatus() with status=paused and a system-generated pause reason string, then logs the event via logAutoPauseEvent for audit purposes. The applyAutoPause method should be idempotent — re-running on an already-paused mentor must not create duplicate log entries or trigger duplicate notifications. Coordinator notifications are emitted via an injected notification service interface, keeping this job decoupled from notification delivery details.

Ensure the job handles partial failures gracefully: a failed notification must not roll back a successful pause transition.

Responsibilities

  • Query mentors with expired certifications (HLF-specific)
  • Auto-transition expired mentors to paused status
  • Emit coordinator notification for each auto-paused mentor

Interfaces

run(): Promise<AutoPauseResult>
findExpiredCertifications(): Promise<MentorCertification[]>
applyAutoPause(mentorId: string): Promise<void>
logAutoPauseEvent(mentorId: string, reason: string): Promise<void>

Relationships

Dependencies (1)

Components this component depends on

Related Data Entities (2)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/certifications 7 endpoints
GET /api/v1/certifications List mentor certifications with optional filters
GET /api/v1/certifications/:id Get a specific certification record
POST /api/v1/certifications Record a new certification for a mentor
PUT /api/v1/certifications/:id Update a certification record (e.g. renew expiry date)
DELETE /api/v1/certifications/:id Remove a certification record
POST /api/v1/certifications/expiry-job/run Manually trigger the certification expiry auto-pause job
+1 more