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

Description

Backend service responsible for evaluating badge criteria and awarding badges to peer mentors. Triggered after activity saves, course enrollment completions, and certification awards. Awards badges by creating user_achievement records and emits unlock events to trigger push notifications.

Feature: Achievement Badges

badge-award-service

Responsibilities

  • Evaluate badge unlock criteria after trigger events (activity saved, course completed, certification awarded)
  • Award badges by inserting user_achievement records when criteria are met
  • Prevent duplicate awards for already-earned badges
  • Emit badge unlock events to trigger push notification delivery
  • Retrieve badge definitions using configuration-driven criteria to avoid code deployments for new badges

Interfaces

evaluateBadgesForUser(userId: String): Future<List<Achievement>>
awardBadge(userId: String, achievementId: String): Future<void>
getEarnedBadges(userId: String): Future<List<UserAchievement>>
checkCriteria(userId: String, achievement: Achievement): Future<bool>
onActivitySaved(activityId: String, userId: String): Future<void>
onCourseCompleted(courseId: String, userId: String): Future<void>

Relationships

Dependencies (3)

Components this component depends on

Dependents (2)

Components that depend on this component

Related Data Entities (2)

Data entities managed by this component