Перейти к содержанию

Доменная модель

Агрегаты

User (auth bounded context)

Поле Тип Правила
id UUID PK
email string unique, optional для TG-only
password_hash string nullable
telegram_id bigint unique, nullable
created_at timestamp

Session (session bounded context)

Aggregate root: Session

Entity Описание
Session Комната с invite_code и lifecycle
Participant Участник в сессии

Session не содержит game logic — только ссылку на active game_instance_id.

GameInstance (game bounded context)

Aggregate root: GameInstance

Entity Описание
GameInstance Один запуск плагина
GameAction Audit entry (value object / entity)

State — opaque JSON для game-runtime; плагин интерпретирует.

Value Objects

VO Поля
InviteCode value: string(6-8), charset
DiceRoll d1: 1-6, d2: 1-6
CellCoord row: 1-6, col: 1-6
ActionId UUID

Связи

erDiagram
    Session ||--|{ Participant : has
    Session ||--|{ GameInstance : contains
    GameInstance ||--|{ GameAction : logs
    User ||--o{ Participant : optional

Bounded Context Map

Context Upstream Downstream
Auth Session
Session Auth Game
Game Session Media, Realtime
Media Game Clients
Realtime Session, Game Clients

См. также