Skip to content

[TODO Import][Server][Backlog] Achievements system implementation #12

Description

@ferneediaz

Imported from server/TODO.md.

Kanban

  • Column: Backlog
  • Area: Server

📋 TODO - Achievements System (LOW PRIORITY)

Player achievement tracking and badges.

Task Breakdown:

1. Prisma Schema Updates

  • Add Achievement model (id, key, name, description, icon, category)
  • Add UserAchievement model (id, userId, achievementId, unlockedAt)
  • Run migration
  • Success Criteria: Schema compiles ✅

2. Achievement Definitions

Key Name Description Trigger
first_blood First Blood Win your first battle 1st win
streak_5 On Fire Win 5 battles in a row 5 consecutive wins
streak_10 Unstoppable Win 10 battles in a row 10 consecutive wins
streak_25 Legendary Win 25 battles in a row 25 consecutive wins
speed_demon Speed Demon Solve a problem in under 2 minutes Submit < 120s
comeback_king Comeback King Win after opponent passed more tests first Win after trailing
language_python Pythonista Win 10 battles using Python 10 Python wins
language_js JS Wizard Win 10 battles using JavaScript 10 JS wins
clan_champion Clan Champion Win 10 clan wars 10 clan war wins
contributor Problem Setter Contribute a problem that gets approved PR merged
season_rank Seasonal Glory Finish a season in top 100 Season end

3. Achievement Service

  • Create achievements/ module
  • checkAndUnlock(userId, event) — Check triggers after battle completion
  • getUserAchievements(userId) — List unlocked achievements
  • getAllAchievements() — List all available achievements
  • Success Criteria: Achievements unlock correctly ✅

4. Achievement API

  • GET /api/achievements — List all achievements (with unlock status for auth'd user)
  • GET /api/users/:id/achievements — List user's unlocked achievements
  • Success Criteria: API tests passing ✅

5. Integration

  • Call checkAndUnlock() after battle completion
  • WebSocket event achievement.unlocked — Notify user of new achievement
  • Success Criteria: Achievements trigger correctly ✅

6. Tests

  • Achievement trigger tests (each achievement type)
  • Duplicate unlock prevention tests
  • Success Criteria: All achievement tests passing ✅

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions