Mentor Activity Log Repository
Component Detail
Description
Data access layer for fetching aggregated activity statistics scoped to a single peer mentor. Queries the activity log table in Supabase with mentor ID filters and returns summary counts by type and period. Reuses the Supabase activity table shared with broader activity registration features.
mentor-activity-log-repository
Summaries
The Mentor Activity Log Repository provides the data foundation for tracking and reporting peer mentor engagement across the platform. By delivering accurate, scoped activity statistics per mentor, it enables program administrators and organizational leaders to measure volunteer output, demonstrate program impact to funders, and make informed decisions about resource allocation. Without reliable activity tracking, organizations cannot substantiate the value of their peer mentoring programs to stakeholders or optimize mentor assignment workloads. This component directly supports retention and recognition efforts by surfacing mentor contributions clearly.
This is a low-complexity data layer component with a well-defined scope: querying the existing Supabase activity table with mentor-scoped filters. Since it reuses an existing shared database table, there is no schema design work required, reducing delivery risk significantly. The three exposed interfaces cover summary aggregation, paginated list retrieval, and type-based counts, all of which are straightforward Supabase queries. Testing requires mock Supabase responses and coverage of period filter logic.
The main scheduling dependency is the availability of the shared activity table schema, which must be finalized before this component can be completed. No backend infrastructure work is needed.
Implemented as a Riverpod-compatible repository class consuming the supabase-client-provider dependency. The getMentorActivitySummary method should issue a Supabase RPC or aggregate query filtering by mentorId and a date range derived from the ActivityPeriod enum (current year, last 12 months, all time). getMentorActivityList supports cursor-based pagination via limit/offset parameters. getMentorActivityCountByType groups results by activity type column.
All responses are mapped to MentorActivitySummary and ActivityLogEntry Dart model classes. Since this runs in frontend and mobile execution contexts, ensure queries are lightweight and avoid N+1 patterns. No write operations are defined here; this is a read-only repository.
Responsibilities
- Fetch activity summary (total count, hours, type breakdown) for a mentor
- Support period filters (current year, last 12 months, all time)
- Return raw activity list for detailed log view navigation
- Map Supabase rows to MentorActivitySummary and ActivityLogEntry models
Interfaces
getMentorActivitySummary({required String mentorId, ActivityPeriod period})
getMentorActivityList({required String mentorId, int limit, int offset})
getMentorActivityCountByType(String mentorId)
Relationships
Dependencies (1)
Components this component depends on
Dependents (2)
Components that depend on this component