Data Layer low complexity Shared Component mobilebackend
0
Dependencies
2
Dependents
1
Entities
1
Integrations

Description

Data access layer for reading and writing peer mentor status fields in Supabase. Manages the status enum (active, paused, inactive), pause timestamps, and pause reasons. Shared with the peer mentor detail screen feature which also reads mentor status.

Feature: Peer Mentor Pause & Reactivation

mentor-status-repository

Summaries

The Mentor Status Repository is a foundational data component that ensures your organization always has an accurate, real-time view of which peer mentors are available, paused, or inactive. By centralizing all status information in one reliable layer, coordinators can make faster, better-informed assignment decisions without risk of assigning participants to unavailable mentors. This directly reduces coordinator workload, minimizes participant experience disruptions, and supports compliance with chapter-level eligibility rules. Because this component is shared across multiple product features, investment in its quality delivers multiplied returns across the entire platform.

This is a low-complexity data access component that is shared across multiple features, making it a high-priority item to deliver early in the project schedule. Any feature dependent on mentor status — including the peer mentor detail screen and assignment pool queries — is blocked until this component is complete and tested. Teams should plan for integration testing against Supabase with real enum values and edge cases around pause timestamps. The real-time streaming interface (watchStatus) requires careful testing for connection handling.

Estimate 3–5 days for implementation plus integration tests, with shared ownership between mobile and backend tracks.

This data-layer component wraps Supabase CRUD operations for the peer_mentors table, specifically the status enum (active, paused, inactive), pause_at timestamp, and pause_reason fields. It exposes both Future-based methods for one-shot reads/writes and a Stream-based watchStatus for real-time UI reactivity. The getActiveMentors and getPausedMentors methods issue filtered queries against chapterId, making them suitable for coordinator listing screens and assignment pool filtering. Since this component is shared with the peer mentor detail screen feature, any schema changes to peer_mentors must be coordinated across both consumers.

Keep Supabase client injection abstract to enable unit testing with mocked responses.

Responsibilities

  • Read and write mentor status enum in Supabase peer_mentors table
  • Store pause_at timestamp and optional pause reason on status change
  • Filter mentors by status for assignment pool and coordinator listing queries

Interfaces

updateStatus(mentorId: String, status: MentorStatus, reason: String?): Future<void>
getStatus(mentorId: String): Future<MentorStatusRecord>
getActiveMentors(chapterId: String): Future<List<PeerMentor>>
getPausedMentors(chapterId: String): Future<List<PeerMentor>>
watchStatus(mentorId: String): Stream<MentorStatusRecord>

Relationships

Dependents (2)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component

Used Integrations (1)

External integrations and APIs this component relies on

API Contract

View full contract →
REST /api/v1/mentor-statuses 7 endpoints
GET /api/v1/mentor-statuses List all mentor status records (audit log)
GET /api/v1/mentor-statuses/:id Get a single mentor status record
POST /api/v1/mentor-statuses Write a new status change record
PUT /api/v1/mentor-statuses/:id Update a status record (e.g. correct reason text)
DELETE /api/v1/mentor-statuses/:id Delete a status record
GET /api/v1/chapters/:chapter_id/mentors/active List active, assignment-eligible mentors in a chapter
+1 more