Data Layer low complexity backend
0
Dependencies
3
Dependents
2
Entities
0
Integrations

Description

Data repository managing the achievements and user_achievements tables. Provides CRUD operations for badge definitions and user badge unlock records. Supports queries for earned badges per user and prevents duplicate award insertion.

Feature: Achievement Badges

achievements-repository

Responsibilities

  • Retrieve all available achievement badge definitions
  • Query earned badges for a specific user from user_achievements
  • Insert user_achievement records when a badge is awarded
  • Check whether a user has already earned a specific badge
  • Support badge definition management (criteria JSON, icon references, names, descriptions)

Interfaces

getAllAchievements(): Future<List<Achievement>>
getEarnedAchievements(userId: String): Future<List<UserAchievement>>
awardAchievement(userId: String, achievementId: String, awardedAt: DateTime): Future<void>
hasAchievement(userId: String, achievementId: String): Future<bool>
getAchievementById(id: String): Future<Achievement?>

Relationships

Dependents (3)

Components that depend on this component

Related Data Entities (2)

Data entities managed by this component