Save current game event to database for use in the match

This commit is contained in:
NG (Graham) committed 2025-07-22 21:36:35 -04:00
1 parent 0683de965b
commit fd11b8746b
11 files changed
+240 -23

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "game_events")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub creation_time: i64, // seconds since unix epoch
pub map: String,
pub mode: super::multiplayer_game::GameMode,
pub visibility: super::multiplayer_game::MapVisibility,
pub auto_heal: bool,
pub start: i64, // seconds since unix epoch
pub end: i64, // seconds since unix epoch
pub variant: EventVariant,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}
#[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "String(StringLen::None)", rename_all = "PascalCase")]
pub enum EventVariant {
Multiplayer,
Singleplayer,
}
+1
View File
@@ -8,6 +8,7 @@ pub mod common_query;
pub mod sanction;
pub mod multiplayer_game;
pub mod multiplayer_game_player;
pub mod game_event;
pub fn parse_int_csv(s: &str) -> Vec<u32> {
s.split(',').filter_map(|i_as_s| {