ActivityRepository
Component Detail
Description
Data access layer that handles reading and writing activity records to persistent storage. Abstracts the underlying database from the service layer and provides typed query methods for activity retrieval and creation. Supports offline-first scenarios by writing to a local store when connectivity is unavailable.
activity-repository
Sources & reasoning
All four organizations named activity logging their top priority; line 18 identifies systemic underreporting as the core problem; line 22 demonstrates scale (380 registrations/year); line 24 establishes the minimal cognitive load design principle. Blueprint assigns [MVP] matching the Fase 1 roadmap mandate for 'Aktivitetsregistrering med lavest mulig antall klikk'.
-
docs/source/likeperson.md · line 18Fellesnevneren er at rapporteringen er så tungvint at det fører til massiv underrapportering - enten fordi folk ikke orker, eller fordi de ikke engang skjønner at det de gjør teller.
-
docs/source/likeperson.md · line 22En likeperson hadde 380 enkeltregistreringer på ett år. Standardverdier (dagens dato, 30 min) som kan overstyres. 60-70 % av registreringene er uten refusjon og skal være ekstremt enkle.
-
docs/source/likeperson.md · line 24Designprinsipp: Lavest mulig kognitiv belastning. Standardvalg, gjenkjennelig logikk, færrest mulig steg.
Responsibilities
- Insert new activity records into persistent storage
- Query activity records by contact, date range, or peer mentor
- Support local-first writes with deferred sync when offline
- Expose typed interfaces so callers never interact with raw SQL or storage APIs
Interfaces
create(activity: ActivityRecord): Promise<ActivityRecord>
findByContact(contactId: string): Promise<ActivityRecord[]>
findByDateRange(start: Date, end: Date): Promise<ActivityRecord[]>
findByMentor(mentorId: string): Promise<ActivityRecord[]>
Related Data Entities (3)
Data entities managed by this component