Achievement Service
Component Detail
Service Layer
high complexity
backend
2
Dependencies
3
Dependents
3
Entities
0
Integrations
Description
Core business logic service responsible for evaluating badge trigger conditions and awarding badges to users. Runs nightly evaluation jobs checking activity counts, streaks, first-time events, and half-year summaries. Also handles coordinator-granted nomination badges through an explicit grant API.
achievement-service
Responsibilities
- Evaluate all badge trigger conditions for a given user against activity and statistics data
- Award new badges by writing to the user_badges join table
- Compute half-year summary badges at June 30 and December 31 cutoffs
- Process coordinator-granted nomination badges on explicit request
- Provide badge progress data (percentage toward next threshold) for UI display
Interfaces
evaluateBadgesForUser(userId)
evaluateAllUsers()
awardBadge(userId, badgeId, metadata)
grantNominationBadge(userId, badgeId, nominatorId)
getBadgeProgress(userId)
getUserBadges(userId)
computeHalfYearBadges(period)
revokeBadge(userBadgeId)
getBadgeDefinitions()
checkActivityThreshold(userId, threshold)
Relationships
Dependencies (2)
Components this component depends on
Dependents (3)
Components that depend on this component
Related Data Entities (3)
Data entities managed by this component