# 4. Data Models ## Entity Relationship Diagram ``` ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ User │ │ Account │ │ Character │ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ id │ │ id │ │ id │ │ email │──┐ │ name │──┐ │ name │ │ password │ │ │ userId ◄─┘ │ │ level │ │ createdAt │ └───►│ createdAt │ └───►│ classId │ │ updatedAt │ │ updatedAt │ │ serverId │ └─────────────┘ └─────────────┘ │ accountId ◄─┘ │ createdAt │ │ updatedAt │ └──────┬──────┘ │ ┌────────────────────────────┼────────────────────────────┐ │ │ │ ▼ ▼ ▼ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ Team │ │TeamMember │ │ CharProgress│ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ id │◄─────────────│ teamId │ │ id │ │ name │ │ characterId │◄─────────────│ characterId │ │ type │ │ joinedAt │ │ progressId │ │ userId │ └─────────────┘ │ completed │ │ createdAt │ │ completedAt │ │ updatedAt │ └─────────────┘ └─────────────┘ │ │ ▼ ┌─────────────┐ │ Progression │ ├─────────────┤ │ id │ │ name │ │ type │ │ category │ │ dofusDbId │ └─────────────┘ ``` ## Core Entities ### User ```typescript interface User { id: string; email: string; passwordHash: string; createdAt: Date; updatedAt: Date; } ``` ### Account ```typescript interface Account { id: string; name: string; userId: string; createdAt: Date; updatedAt: Date; } ``` ### Character ```typescript interface Character { id: string; name: string; level: number; classId: number; className: string; serverId: number; serverName: string; accountId: string; createdAt: Date; updatedAt: Date; } ``` ### Team ```typescript interface Team { id: string; name: string; type: 'MAIN' | 'SECONDARY' | 'CUSTOM'; userId: string; createdAt: Date; updatedAt: Date; } ``` ### Progression ```typescript interface Progression { id: string; name: string; type: 'QUEST' | 'DUNGEON' | 'ACHIEVEMENT' | 'DOFUS'; category: string; dofusDbId: number | null; } ``` ### CharacterProgression ```typescript interface CharacterProgression { id: string; characterId: string; progressionId: string; completed: boolean; completedAt: Date | null; } ``` ---