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

Description

PostgreSQL table recording awarded badges per user with a timestamp and reference to the triggering entity. Acts as the persistent state for the gallery screen's earned/locked computation and feeds into the Annual Summary payload.

Feature: Achievement Badges

user-achievements-table

Responsibilities

  • Record badge award events with user ID, badge ID, timestamp, and triggering entity reference
  • Provide per-user achievement list for gallery lock/unlock computation
  • Support querying achievements by user and year for Annual Summary integration
  • Enforce uniqueness of badge awards per user to prevent duplicate awards

Interfaces

findByUserId(userId) → Promise<UserAchievement[]>
findByUserIdAndYear(userId, year) → Promise<UserAchievement[]>
create(achievement: CreateUserAchievementDto) → Promise<UserAchievement>
existsByUserAndBadge(userId, badgeId) → Promise<boolean>

Relationships

Dependencies (1)

Components this component depends on

Dependents (2)

Components that depend on this component