4.9 KiB
4.9 KiB
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
interface User {
id: string;
email: string;
passwordHash: string;
createdAt: Date;
updatedAt: Date;
}
Account
interface Account {
id: string;
name: string;
userId: string;
createdAt: Date;
updatedAt: Date;
}
Character
interface Character {
id: string;
name: string;
level: number;
classId: number;
className: string;
serverId: number;
serverName: string;
accountId: string;
createdAt: Date;
updatedAt: Date;
}
Team
interface Team {
id: string;
name: string;
type: 'MAIN' | 'SECONDARY' | 'CUSTOM';
userId: string;
createdAt: Date;
updatedAt: Date;
}
Progression
interface Progression {
id: string;
name: string;
type: 'QUEST' | 'DUNGEON' | 'ACHIEVEMENT' | 'DOFUS';
category: string;
dofusDbId: number | null;
}
CharacterProgression
interface CharacterProgression {
id: string;
characterId: string;
progressionId: string;
completed: boolean;
completedAt: Date | null;
}