Achievement Service
Component Detail
Service Layer
medium complexity
mobile
1
Dependencies
1
Dependents
5
Entities
0
Integrations
Description
Core business logic service that manages badge eligibility evaluation, award processing, and progress tracking. Communicates with the backend REST API to fetch badge definitions, check eligibility after triggering events (activity saves, expense submissions, certificate issuance), and process badge awards with push notification dispatch.
achievement-service
Responsibilities
- Evaluate badge eligibility against achievement type trigger conditions
- Process badge awards and persist to backend via REST API
- Track progress toward incomplete badge milestones
- Trigger push notifications on badge award via notification pipeline
- Support both automatic trigger-based and coordinator-granted badges
Interfaces
fetchAllBadges(userId: String): Future<List<Badge>>
fetchBadgeDefinitions(orgId: String): Future<List<AchievementType>>
evaluateEligibility(userId: String, eventType: String): Future<List<Badge>>
awardBadge(userId: String, badgeTypeId: String): Future<Badge>
getProgress(userId: String, badgeTypeId: String): Future<BadgeProgress>
getNewlyUnlockedBadges(userId: String, since: DateTime): Future<List<Badge>>
checkMilestone(userId: String, metric: String, value: int): Future<bool>
grantCoordinatorBadge(coordinatorId: String, userId: String, badgeTypeId: String): Future<Badge>
Relationships
Related Data Entities (5)
Data entities managed by this component