Data Layer medium complexity mobile
0
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Persists badge definitions and user-badge award records in local storage. Provides query access to earned badges, locked badges, and award history for a given user. Acts as the source of truth for badge state surfaced across profile and dashboard screens.

Feature: Achievement Badges

badge-store

Sources & reasoning

Badges are explicitly mentioned in §2.2 alongside Wrapped and listed by name in the Fase 3 (Growth & Engagement) deliverables, anchoring both scope and target_release.

  • Også nevnt: «Årets koordinator», statusbadges og halvårsoppsummeringer.
  • Fase 3 - Vekst og engasjement - Gamification / «Ditt likepersonsår» (Wrapped, badges, Advantage Calculator)

Responsibilities

  • Persist badge award records with userId, badgeId, and awarded timestamp
  • Store badge definitions including qualification rules and metadata
  • Query earned badges for a user filtered by category or date
  • Query locked badges with current progress state
  • Prevent duplicate awards through uniqueness constraints

Interfaces

saveBadgeAward(userId, badgeId, awardedAt): void
getEarnedBadges(userId): Badge[]
getLockedBadges(userId): Badge[]
hasBadge(userId, badgeId): boolean