Impact Summary Repository
Component Detail
Data Layer
medium complexity
backendmobile
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Data access layer that provides CRUD operations for the impact_summaries table in Supabase, supporting both server-side persistence from the Impact Calculation Service and client-side reads for offline rendering. Caches the summary JSON payload locally to support offline access after the initial load.
impact-summary-repository
Responsibilities
- Persist computed impact summary payloads to the impact_summaries table
- Retrieve summary records by user ID, period type, and year
- Cache summary payloads locally for offline rendering on mobile
- Provide streaming subscriptions for real-time summary availability updates
Interfaces
saveSummary(summary)
getSummaryByPeriod(userId, periodType, year)
getAllSummariesForUser(userId)
deleteSummary(summaryId)
cacheSummaryLocally(summary)
getCachedSummary(userId, periodType, year)
watchSummaryAvailability(userId)
clearCache(userId)