Service Layer medium complexity backend
1
Dependencies
1
Dependents
2
Entities
0
Integrations

Description

Service responsible for automatically suppressing expired peer mentors from coordinator views and public chapter website listings when their certificate lapses without renewal. Works in conjunction with Supabase RLS policies or computed columns to enforce visibility rules at the data layer.

Feature: Certificate Expiry Notifications

mentor-visibility-suppressor

Summaries

The Peer Mentor Visibility Suppressor protects program quality and participant trust by automatically removing mentors with expired certifications from coordinator contact lists and public chapter website listings the moment their certification lapses without renewal. This ensures participants and coordinators are never inadvertently directed to an unqualified mentor, protecting the organization's reputation and maintaining the integrity of the program. By enforcing this rule automatically at the data layer through Supabase RLS policies, the organization eliminates the need for manual roster auditing, reducing administrative overhead and removing the human error risk inherent in manual visibility management across large coordinator rosters. Restoration upon renewal is equally automatic, ensuring qualified mentors return to listings without coordinator intervention.

This medium-complexity backend service carries significant data integrity responsibility and requires careful coordination with the database team for Supabase RLS policy configuration. It depends on certification-expiry-repository for expiry event detection and must integrate with the peer-mentor-status-management service for status updates on suppression and restoration events. The primary delivery risk is RLS policy configuration and testing in the Supabase staging environment — row-level security changes have broad impact across all queries touching the peer_mentor_profile table and require thorough validation before production deployment. The coordinator notification side effect on auto-suppression must be tested as a distinct output alongside the visibility change itself.

Restoration logic (`onCertificateRenewed`) must be explicitly validated to ensure mentors are not left in a suppressed state following a successful renewal, as this would constitute a silent data integrity failure.

Implements mentor visibility enforcement via `suppressExpiredMentor(mentorId: String)` and `restoreMentorVisibility(mentorId: String)`, driven by `onCertificateExpired(mentorId)` and `onCertificateRenewed(mentorId)` lifecycle hooks sourced from the certification-expiry-repository event stream. `isMentorSuppressed(mentorId) -> bool` and `getSuppressedMentors(coordinatorId) -> List` expose query interfaces for coordinator views. Enforcement is implemented either via a Supabase RLS policy reading a computed `is_suppressed` column on peer_mentor_profile, or by updating a visibility flag that RLS policies filter on — the computed column approach is preferred to avoid stale flag state under concurrent updates. Suppression events emit a coordinator notification as a side effect.

All public methods must be idempotent: repeated calls to suppress or restore must not produce inconsistent state or duplicate side effects. Depends on certification-expiry-repository and operates on peer_mentor_profile and certificate data models. Backend execution context only.

Responsibilities

  • Detect certificate expiry and trigger suppression of mentor from active listings
  • Restore mentor visibility upon certificate renewal
  • Notify coordinator when mentor is auto-suppressed
  • Integrate with peer-mentor-status-management for status updates

Interfaces

suppressExpiredMentor(mentorId: String)
restoreMentorVisibility(mentorId: String)
isMentorSuppressed(mentorId: String) -> bool
getSuppressedMentors(coordinatorId: String) -> List<PeerMentor>
onCertificateExpired(mentorId: String)
onCertificateRenewed(mentorId: String)

Relationships

Dependencies (1)

Components this component depends on

Dependents (1)

Components that depend on this component

Related Data Entities (2)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/mentor-suppressions 5 endpoints
GET /api/v1/mentor-suppressions
GET /api/v1/mentor-suppressions/:mentor_id
POST /api/v1/mentor-suppressions
PUT /api/v1/mentor-suppressions/:mentor_id
DELETE /api/v1/mentor-suppressions/:mentor_id