Badge Repository
Component Detail
Data Layer
low complexity
backend
0
Dependencies
0
Dependents
2
Entities
0
Integrations
Description
Data access layer managing the achievement_badges and user_badges tables. Badge definitions are stored as configuration data to allow administrators to add or modify criteria without a code deployment. Handles reads for badge catalogues scoped per organisation and writes for user badge award records.
badge-repository
Responsibilities
- CRUD operations on achievement_badges configuration records
- Insert and query user_badges award records
- Fetch badge catalogue filtered by organisation
- Return user progress values against badge thresholds
Interfaces
getBadgeById(badgeId)
getBadgesByOrg(orgId)
getAllBadges()
createBadge(badgeData)
updateBadge(badgeId, updates)
deleteBadge(badgeId)
awardBadgeToUser(userId, badgeId)
getUserBadges(userId)
getUserBadgeProgress(userId)
hasBadge(userId, badgeId)
Related Data Entities (2)
Data entities managed by this component