# Task ID: 5 # Title: User Profile & Data Models (Server & DB) # Status: pending # Dependencies: 2, 4 # Priority: high # Description: Define and implement the server-side data models and APIs for user profiles, including nickname, avatar, level, experience, and basic game statistics. This task focuses on persistent storage and retrieval of user data. # Details: Update MongoDB User model to include `level`, `experience`, `rank`, `stats` (totalGames, wins, winRate, currentStreak, maxStreak), and `achievements`. Implement API endpoints for fetching and updating user profiles. Ensure data consistency and validation. # Test Strategy: Create/update user profiles via API. Verify data is correctly stored in MongoDB and retrieved. Test edge cases for stats updates (e.g., first game, win/loss).