AnnualSummaryRepository
Component Detail
Data Layer
medium complexity
backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Handles persistence and retrieval of computed annual summary records for peer mentors. Stores pre-aggregated summary payloads keyed by user and year to support fast reads on subsequent views. Provides query methods used by AnnualSummaryService to check for existing records and write new ones.
annual-summary-repository
Sources & reasoning
Three of four organizations explicitly requested a Spotify Wrapped-style summary in workshops (line 76). The priority matrix places it NICE TO HAVE in Phase 3 (line 149), and the Phase 3 roadmap confirms it alongside badges and Advantage Calculator (line 353). Phase 3 normalizes to v1.1.
-
docs/source/likeperson.md · line 76Tre organisasjoner er inspirert av Spotify Wrapped og ønsker en funksjon som viser likepersonens bidrag over tid - «Din likepersonsårek». Målet er å gi frivillige stolthet og motivasjon
-
docs/source/likeperson.md · line 149| Gamification / Spotify Wrapped | ✓ | ✓ | - | ✓ | ✓ | NICE TO HAVE | 3 |
-
docs/source/likeperson.md · line 353Gamification / «Ditt likepersonsår» (Wrapped, badges, Advantage Calculator)
Responsibilities
- Store serialized AnnualSummary records indexed by userId and year
- Retrieve existing summary records without recomputation
- Delete or expire stale summary records when underlying activity data changes
- Query raw activity totals per year as input for summary generation
Interfaces
findByUserAndYear(userId: string, year: number): Promise<AnnualSummaryRecord | null>
save(summary: AnnualSummaryRecord): Promise<void>
deleteByUserAndYear(userId: string, year: number): Promise<void>
getActivityTotalsByYear(userId: string, year: number): Promise<ActivityTotals>