AchievementService
Component Detail
Service Layer
medium complexity
backend
0
Dependencies
0
Dependents
2
Entities
0
Integrations
Description
Backend service that evaluates milestone rules against a mentor's activity data and determines which badges have been earned. It listens for activity-completion events from the simple-activity-logging feature and runs threshold checks after each event. When a new badge is unlocked it persists the award and emits a notification event.
achievement-service
Sources & reasoning
Statusbadges are explicitly named alongside the Wrapped concept in workshop output at line 76. The priority matrix (line 149) places the gamification cluster as NICE TO HAVE in Phase 3. The Phase 3 roadmap at line 353 groups badges with Wrapped and Advantage Calculator, normalizing to v1.1.
-
docs/source/likeperson.md · line 76Tre organisasjoner er inspirert av Spotify Wrapped og ønsker en funksjon som viser likepersonens bidrag over tid - «Din likepersonsårek». Målet er å gi frivillige stolthet og motivasjon, og gjøre usynlig innsats synlig. Også nevnt: «Årets koordinator
-
docs/source/likeperson.md · line 149| Gamification / Spotify Wrapped | ✓ | ✓ | - | ✓ | ✓ | NICE TO HAVE | 3 |
-
docs/source/likeperson.md · line 353Gamification / «Ditt likepersonsår» (Wrapped, badges, Advantage Calculator)
Responsibilities
- Subscribe to activity-logged events and trigger badge evaluation
- Evaluate all defined milestone rules against current mentor statistics
- Persist newly earned badges via AchievementRepository
- Emit badge-earned domain events for notification and widget refresh
- Provide a query endpoint returning a mentor's full badge status list
Interfaces
evaluateBadges(mentorId: string): Promise<EvaluationResult>
getBadgeStatus(mentorId: string): Promise<BadgeStatus[]>
onActivityLogged(event: ActivityLoggedEvent): Promise<void>
listMilestoneRules(): MilestoneRule[]
Related Data Entities (2)
Data entities managed by this component