CRITICAL story-certificate-expiry-notifications-peer-mentor-006 8 pts
8
Story Points
Critical
Priority
Certificate Expiry Notifications
Feature

User Story

As a Peer Mentor (Likeperson)
I want to understand that my profile will be automatically suppressed from HLF's public-facing website and active peer mentor lists when my certification expires
So that I know the real-world consequences of inaction and am motivated to renew my certification promptly

Acceptance Criteria

  • Given a peer mentor's certification expired at midnight, When the expiry check edge function runs, Then the mentor's active status is set to false and the visibility suppressor updates the record
  • Given the mentor's active status is set to false, When a public query is made for active peer mentors in their chapter, Then the expired mentor is excluded from results due to RLS policy enforcement
  • Given the mentor's active status has been suppressed, When the mentor opens their own profile in the app, Then they see a clear status banner: 'Your certification has expired. You are currently not visible to the public.'
  • Given the mentor's certification is renewed and confirmed, When the certification management service updates the record, Then the visibility suppressor re-enables the active status and the mentor reappears in public listings
  • Given a mentor whose certificate expired while they were on pause, When the nightly scheduler runs, Then both the pause status and the expired certification are reflected correctly without conflict
  • Given the RLS policy is active, When an unauthenticated query attempts to retrieve an expired peer mentor's profile, Then the record is not returned and no error is thrown

Business Value

HLF's workshop confirmed that when a peer mentor's certificate expires, they must automatically disappear from the organization's public website. Manually managing this across potentially hundreds of mentors is error-prone and creates compliance risk. Automating suppression via RLS at the database level ensures the organization's public-facing information is always accurate without requiring any administrative action, directly addressing a core HLF requirement.