Peer Mentor Repository
Component Detail
Description
Data access layer for peer mentor profile records in Supabase. Provides typed Dart models for peer mentor data including profile fields, pause state, and organization membership. Shared with contact list and contact detail features that display peer mentor cards.
peer-mentor-repository
Summaries
The Peer Mentor Repository is a foundational shared component that powers mentor visibility across multiple user-facing features including contact lists, contact detail cards, and the full mentor detail screen. Its reuse across features reduces development cost and ensures consistency in how mentor data is presented and updated throughout the application. The ability to filter mentors by status and organization enables administrators to quickly surface active, qualified mentors to those who need support, directly improving match quality and reducing time-to-connection. Real-time watch capability via watchMentorById supports live status updates without requiring manual refreshes.
A low-complexity shared repository that is a critical dependency for at least three features: contact list, contact detail, and peer mentor detail. Its early delivery unblocks parallel development across all three feature teams simultaneously. Shared ownership means any interface change has wide regression impact — coordinate with all consuming feature leads before modifying method signatures. Test coverage must include getMentorById, getMentorsByOrganization with and without status filters, both update methods, and the real-time watch stream.
Supabase schema stability is the primary external dependency risk; confirm table structure is finalized before beginning implementation to avoid costly rework.
Wraps the Supabase client (via supabase-client-provider) with typed Dart models using JSON deserialization from Supabase's PostgREST responses. getMentorById and watchMentorById share the same query path, with watch implemented via Supabase's realtime subscription API returning a Stream
PeerMentorProfile is an immutable Dart class with a fromJson factory. As a shared component, avoid adding feature-specific query logic here — keep it generic and let callers filter in-memory or via the aggregation service layer.
Responsibilities
- Fetch single peer mentor profile by ID from Supabase
- Update peer mentor pause/active status
- Query peer mentors by organization with status filters
- Map Supabase JSON response to typed PeerMentorProfile Dart model
Interfaces
getMentorById(String mentorId)
getMentorsByOrganization({required String orgId, MentorStatus? statusFilter})
updateMentorStatus({required String mentorId, required MentorStatus status})
updateCertificationExpiry({required String mentorId, required DateTime expiryDate})
watchMentorById(String mentorId)
Relationships
Dependencies (1)
Components this component depends on
Dependents (2)
Components that depend on this component
Used Integrations (1)
External integrations and APIs this component relies on