Peer Mentor Status Repository
Component Detail
Description
Supabase data access layer for peer mentor status records and pause history. Manages the peer_mentor_status table including current status enum, pause start_date, expected_return_date, and transition audit log. Shared across pause and profile features.
peer-mentor-status-repository
Summaries
The Peer Mentor Status Repository is the authoritative data store for every mentor's current standing within the program — whether active, paused, or lapsed. By centralizing this data, the organization gains a reliable, auditable record of status transitions that supports compliance reporting, coordinator oversight, and fair treatment of mentors. Coordinators can quickly surface mentors needing attention without manual spreadsheet tracking, reducing administrative burden and improving program oversight quality. Because this component is shared across multiple features, investments in its reliability and performance benefit the entire platform simultaneously, delivering compounding value across the product.
As a shared, medium-complexity data component, the Peer Mentor Status Repository sits on the critical path for both the pause management and profile features. Any schema changes or API contract updates will require coordinated releases across all consuming features — flag this as a coordination risk in sprint planning. The getMentorsByStatus() and getAllWithExpiringCerts() query methods need performance testing with realistic data volumes before release, particularly for coordinator roster views with large cohorts. Testing should include edge cases around concurrent status transitions.
Recommend defining the interface contract early in the project to unblock parallel feature development.
Implemented as a Supabase data access layer targeting the peer_mentor_status table, this repository exposes typed CRUD and query interfaces consumed by the pause workflow, profile feature, and expiry checker. Key methods include updateStatus() with metadata for audit context, createPauseRecord()/closePauseRecord() for period lifecycle management, and coordinator-scoped queries like getMentorsByStatus(coordinatorId, status). Because this component is shared (is_shared: true), its interface must remain stable — use versioned method signatures or adapter patterns when evolving the contract. Ensure all write operations use Supabase RLS policies scoped to the coordinator's assignment to prevent cross-tenant data access.
Responsibilities
- CRUD operations for peer mentor status records
- Query mentors by status for coordinator roster view
- Persist pause period history with timestamps
- Provide coordinator-scoped queries filtered by assignment
Interfaces
getStatus(mentorId)
updateStatus(mentorId, newStatus, metadata)
createPauseRecord(mentorId, startDate, expectedReturnDate?)
closePauseRecord(mentorId, endDate)
getPauseHistory(mentorId)
getMentorsByStatus(coordinatorId, status)
getAllWithExpiringCerts(daysThreshold)
Relationships
Dependents (2)
Components that depend on this component