AnnualSummaryRepository
Component Detail
Data Layer
medium complexity
backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Data access layer responsible for persisting and retrieving computed annual summaries. It abstracts the underlying database operations and exposes a clean interface for reading and writing summary records. The repository ensures that pre-computed summaries are stored efficiently and can be retrieved quickly on subsequent requests.
annual-summary-repository
Sources & reasoning
Lines 76 and 353 confirm three organizations explicitly requested a Spotify Wrapped-style year-in-review. The priority matrix (line 149) classifies it NICE TO HAVE in Fase 3, mapping to v1.1. The feature directly addresses the stated goal of making volunteer effort visible and motivating continued engagement.
-
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».
-
docs/source/likeperson.md · line 149| Gamification / Spotify Wrapped | ✓ | ✓ | - | ✓ | ✓ | NICE TO HAVE | 3 |
-
docs/source/likeperson.md · line 353- Gamification / «Ditt likepersonsår» (Wrapped, badges, Advantage Calculator)
Responsibilities
- Persist computed annual summary records keyed by user ID and year
- Retrieve existing summary records to avoid redundant AI or aggregation calls
- Delete or invalidate stale summary records when underlying activity data changes
- Query raw activity statistics from the personal-activity-statistics data source when no cached summary exists
Interfaces
findByUserAndYear(userId: string, year: number): Promise<AnnualSummary | null>
save(summary: AnnualSummary): Promise<void>
deleteByUserAndYear(userId: string, year: number): Promise<void>