Service Layer medium complexity backend
0
Dependencies
0
Dependents
2
Entities
0
Integrations

Description

Backend service encapsulating all business logic for evaluating badge criteria, awarding badges, and querying badge state per user. Evaluates configurable per-tenant thresholds against activity and contact statistics, then persists awards and triggers push notifications on unlock.

Feature: Achievement Badges

achievement-service

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.

  • Målet er å gi frivillige stolthet og motivasjon, og gjøre usynlig innsats synlig. Også nevnt: «Årets koordinator», statusbadges og halvårsoppsummeringer.
  • | Gamification / Spotify Wrapped | ✓ | ✓ | - | ✓ | ✓ | NICE TO HAVE | 3 |

Responsibilities

  • Evaluate badge criteria against user activity and contact statistics
  • Award badges transactionally and prevent duplicate awards
  • Resolve tenant-specific badge configuration and thresholds
  • Trigger push notifications via the notifications subsystem when a badge is earned
  • Expose badge progress state for a given user

Interfaces

evaluateBadges(userId: string, tenantId: string): Promise<AwardResult[]>
getUserBadges(userId: string): Promise<Badge[]>
getBadgeProgress(userId: string, badgeId: string): Promise<BadgeProgress>
awardBadge(userId: string, badgeId: string): Promise<void>

Related Data Entities (2)

Data entities managed by this component