Data Layer medium complexity backend
0
Dependencies
1
Dependents
2
Entities
0
Integrations

Description

Data access layer managing all read and write operations against the badges and user_badges database tables. Handles badge definition CRUD, user badge award records, and query operations needed by the achievement service for evaluation and the UI for display.

Feature: Achievement Badges & Status Recognition

badge-repository

Responsibilities

  • Persist and retrieve badge definition records (trigger conditions, display asset URL, eligibility criteria)
  • Create and query user_badge award records with earned timestamps
  • Provide bulk query support for nightly evaluation runs across all users
  • Support filtering by organization, user, and badge category

Interfaces

getBadgeById(badgeId)
getAllBadgeDefinitions()
getBadgesByCategory(category)
getUserBadges(userId)
awardBadgeToUser(userId, badgeId, metadata)
hasBadge(userId, badgeId)
revokeUserBadge(userBadgeId)
getBadgeProgress(userId, badgeId)
getUsersWithBadge(badgeId)
createBadgeDefinition(badge)
updateBadgeDefinition(badgeId, updates)

Relationships

Dependents (1)

Components that depend on this component

Related Data Entities (2)

Data entities managed by this component