werewolves/api/src/game.rs

25 lines
571 B
Rust

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use werewolves_proto::game::{Game, GameSettings, story::GameStory};
use crate::{id_impl, user::UserId};
id_impl!(GameId);
#[cfg_attr(feature = "ssr", derive(::sqlx::FromRow))]
#[derive(Debug)]
pub struct GameRecord {
pub id: GameId,
pub host: UserId,
pub created_at: DateTime<Utc>,
pub game_state: GameRecordState,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum GameRecordState {
Lobby(GameSettings),
RoleReveal(Game),
Started(Game),
GameOver(GameStory),
}