jong/jong-line/src/tables.rs

51 lines
846 B
Rust
Raw Normal View History

use spacetimedb::{SpacetimeType, table};
use jong_types::{
tiles::Tile,
states::{GameState, TurnState},
};
2026-02-11 10:14:02 -08:00
pub mod player;
pub use player::*;
#[derive(Debug, Clone)]
#[table(name = lobby, public)]
pub struct Lobby {
#[primary_key]
#[auto_inc]
pub id: u32,
#[unique]
pub host_player_id: u32,
pub players: Vec<PlayerOrBot>,
2026-02-13 08:16:41 -08:00
pub dealer_idx: u8,
pub current_idx: u8,
pub game_state: GameState,
2026-02-10 01:40:13 -08:00
pub turn_state: TurnState,
}
#[table(name = wall)]
2026-02-12 17:06:28 -08:00
pub struct DbWall {
#[primary_key]
pub lobby_id: u32,
2026-02-12 17:06:28 -08:00
pub tiles: Vec<DbTile>,
}
#[table(name = tile)]
2026-02-13 07:49:09 -08:00
#[derive(Debug, Clone, Copy)]
2026-02-12 17:06:28 -08:00
pub struct DbTile {
#[primary_key]
#[auto_inc]
pub id: u32,
pub tile: Tile,
}
#[derive(Debug, Clone, SpacetimeType)]
pub enum PlayerOrBot {
Player { id: u32 },
Bot { id: u32 },
}