AchievementRepository
Component Detail
Data Layer
medium complexity
backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Data access layer for reading and writing badge definitions, tenant badge configurations, and user badge award records. Provides the persistence interface used exclusively by AchievementService, isolating SQL queries from business logic.
achievement-repository
Sources & reasoning
Line 76 explicitly mentions statusbadges as part of the gamification request from three organizations. The priority matrix (line 149) places gamification in Fase 3 (NICE TO HAVE), mapping to v1.1. Badges provide continuous recognition between annual summaries, complementing the Wrapped feature and supporting volunteer motivation year-round.
-
docs/source/likeperson.md · line 76Målet er å gi frivillige stolthet og motivasjon, og gjøre usynlig innsats synlig. Også nevnt: «Årets koordinator», statusbadges og halvårsoppsummeringer.
-
docs/source/likeperson.md · line 149| Gamification / Spotify Wrapped | ✓ | ✓ | - | ✓ | ✓ | NICE TO HAVE | 3 |
Responsibilities
- Query badge definitions and tenant-specific threshold overrides
- Insert and retrieve user badge award records
- Check existence of prior awards to support idempotent awarding
- Support batch queries for bulk progress evaluation across users
Interfaces
getBadgeDefinitions(tenantId: string): Promise<BadgeDefinition[]>
getUserAwards(userId: string): Promise<UserAward[]>
hasAward(userId: string, badgeId: string): Promise<boolean>
saveAward(userId: string, badgeId: string, awardedAt: Date): Promise<void>