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.

Feature: Annual Summary (Wrapped)

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.

  • Tre organisasjoner er inspirert av Spotify Wrapped og ønsker en funksjon som viser likepersonens bidrag over tid - «Din likepersonsĂĄrek».
  • | Gamification / Spotify Wrapped | âś“ | âś“ | - | âś“ | âś“ | NICE TO HAVE | 3 |
  • - 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>

Related Data Entities (1)

Data entities managed by this component