diff --git a/binaries/flo-stats-service/src/graphql/mod.rs b/binaries/flo-stats-service/src/graphql/mod.rs index 1a2e46b4..4446f6a6 100644 --- a/binaries/flo-stats-service/src/graphql/mod.rs +++ b/binaries/flo-stats-service/src/graphql/mod.rs @@ -40,7 +40,7 @@ impl MutationRoot { return Err(Error::new("Can not stream a private game.")); } - let delay_secs = if let Some(value) = delay_secs { + let mut delay_secs = if let Some(value) = delay_secs { if data.is_admin { value as i64 } else { @@ -53,6 +53,11 @@ impl MutationRoot { 180 } }; + + if let Some(secs) = game.flo_tv_delay_override_secs.clone() { + delay_secs = secs as i64 + } + let delay_secs = if delay_secs == 0 { None } else { diff --git a/crates/controller/src/game/db.rs b/crates/controller/src/game/db.rs index cdb73a48..da94ce86 100644 --- a/crates/controller/src/game/db.rs +++ b/crates/controller/src/game/db.rs @@ -207,6 +207,7 @@ pub fn create(conn: &DbConn, params: CreateGameParams) -> Result { node_id: None, mask_player_names: false, enable_ping_equalizer: false, + flo_tv_delay_override_secs: None, }; let row = conn.transaction(|| -> Result<_> { @@ -232,6 +233,7 @@ pub struct CreateGameAsBotParams { pub slots: Vec, pub mask_player_names: bool, pub enable_ping_equalizer: bool, + pub flo_tv_delay_override_secs: Option, } /// Creates a full game and lock it @@ -349,6 +351,7 @@ pub fn create_as_bot( node_id: Some(params.node_id), mask_player_names: params.mask_player_names, enable_ping_equalizer: params.enable_ping_equalizer, + flo_tv_delay_override_secs: None, }; let row = conn.transaction(|| -> Result<_> { @@ -1014,6 +1017,7 @@ pub struct GameRowWithRelated { pub mask_player_names: bool, pub game_version: Option, pub enable_ping_equalizer: bool, + pub flo_tv_delay_override_secs: Option, } pub(crate) type GameRowWithRelatedColumns = ( @@ -1036,6 +1040,7 @@ pub(crate) type GameRowWithRelatedColumns = ( game::dsl::mask_player_names, game::dsl::game_version, game::dsl::enable_ping_equalizer, + game::dsl::flo_tv_delay_override_secs, ); impl GameRowWithRelated { @@ -1060,6 +1065,7 @@ impl GameRowWithRelated { game::dsl::mask_player_names, game::dsl::game_version, game::dsl::enable_ping_equalizer, + game::dsl::flo_tv_delay_override_secs, ) } @@ -1086,6 +1092,7 @@ impl GameRowWithRelated { mask_player_names: self.mask_player_names, game_version: self.game_version, enable_ping_equalizer: self.enable_ping_equalizer, + flo_tv_delay_override_secs: self.flo_tv_delay_override_secs, }) } } @@ -1105,6 +1112,7 @@ pub struct GameInsert<'a> { pub node_id: Option, pub mask_player_names: bool, pub enable_ping_equalizer: bool, + pub flo_tv_delay_override_secs: Option, } #[derive(Debug, Insertable)] diff --git a/crates/controller/src/game/types.rs b/crates/controller/src/game/types.rs index 0073c69d..40bca6d7 100644 --- a/crates/controller/src/game/types.rs +++ b/crates/controller/src/game/types.rs @@ -32,6 +32,7 @@ pub struct Game { pub mask_player_names: bool, pub game_version: Option, pub enable_ping_equalizer: bool, + pub flo_tv_delay_override_secs: Option, } impl S2ProtoPack for Game { diff --git a/crates/controller/src/schema.rs b/crates/controller/src/schema.rs index f778406b..b056c083 100644 --- a/crates/controller/src/schema.rs +++ b/crates/controller/src/schema.rs @@ -1,4 +1,6 @@ -table! { +// @generated automatically by Diesel CLI. + +diesel::table! { api_client (id) { id -> Int4, name -> Text, @@ -7,7 +9,7 @@ table! { } } -table! { +diesel::table! { game (id) { id -> Int4, name -> Text, @@ -29,10 +31,11 @@ table! { mask_player_names -> Bool, game_version -> Nullable, enable_ping_equalizer -> Bool, + flo_tv_delay_override_secs -> Nullable, } } -table! { +diesel::table! { game_used_slot (id) { id -> Int4, game_id -> Int4, @@ -52,7 +55,7 @@ table! { } } -table! { +diesel::table! { map_checksum (id) { id -> Int4, sha1 -> Text, @@ -60,7 +63,7 @@ table! { } } -table! { +diesel::table! { node (id) { id -> Int4, name -> Text, @@ -74,7 +77,7 @@ table! { } } -table! { +diesel::table! { player (id) { id -> Int4, name -> Text, @@ -88,7 +91,7 @@ table! { } } -table! { +diesel::table! { player_ban (id) { id -> Int4, player_id -> Int4, @@ -98,7 +101,7 @@ table! { } } -table! { +diesel::table! { player_mute (id) { id -> Int4, player_id -> Int4, @@ -107,14 +110,14 @@ table! { } } -joinable!(game -> node (node_id)); -joinable!(game -> player (created_by)); -joinable!(game_used_slot -> game (game_id)); -joinable!(game_used_slot -> player (player_id)); -joinable!(player -> api_client (api_client_id)); -joinable!(player_ban -> player (player_id)); +diesel::joinable!(game -> node (node_id)); +diesel::joinable!(game -> player (created_by)); +diesel::joinable!(game_used_slot -> game (game_id)); +diesel::joinable!(game_used_slot -> player (player_id)); +diesel::joinable!(player -> api_client (api_client_id)); +diesel::joinable!(player_ban -> player (player_id)); -allow_tables_to_appear_in_same_query!( +diesel::allow_tables_to_appear_in_same_query!( api_client, game, game_used_slot, diff --git a/crates/observer-edge/src/game/mod.rs b/crates/observer-edge/src/game/mod.rs index d7ec777b..d8d04655 100644 --- a/crates/observer-edge/src/game/mod.rs +++ b/crates/observer-edge/src/game/mod.rs @@ -494,6 +494,7 @@ pub struct Game { pub mask_player_names: bool, pub is_private: bool, pub is_live: bool, + pub flo_tv_delay_override_secs: Option, } #[derive(Debug, S2ProtoUnpack, SimpleObject)] diff --git a/crates/observer-edge/src/game/snapshot.rs b/crates/observer-edge/src/game/snapshot.rs index b5e7295a..9e3d1e9c 100644 --- a/crates/observer-edge/src/game/snapshot.rs +++ b/crates/observer-edge/src/game/snapshot.rs @@ -159,6 +159,7 @@ pub struct GameSnapshot { pub mask_player_names: bool, pub is_private: bool, pub is_live: bool, + pub flo_tv_delay_override_secs: Option, } impl GameSnapshot { @@ -204,6 +205,7 @@ impl GameSnapshot { mask_player_names: game.mask_player_names, is_private: game.is_private, is_live: game.is_live, + flo_tv_delay_override_secs: game.flo_tv_delay_override_secs, } } } diff --git a/deps/flo-grpc b/deps/flo-grpc index eef2e6d0..b88277ac 160000 --- a/deps/flo-grpc +++ b/deps/flo-grpc @@ -1 +1 @@ -Subproject commit eef2e6d01032791b6c4dcfcd120a1e7a264a9255 +Subproject commit b88277ac2ee202fec817c77b4cf20c6e2d6e9122 diff --git a/migrations/2023-11-01-135902_game-flo-tv-delay/down.sql b/migrations/2023-11-01-135902_game-flo-tv-delay/down.sql new file mode 100644 index 00000000..b79568b2 --- /dev/null +++ b/migrations/2023-11-01-135902_game-flo-tv-delay/down.sql @@ -0,0 +1,2 @@ +alter table "game" + drop column flo_tv_delay_override_secs; \ No newline at end of file diff --git a/migrations/2023-11-01-135902_game-flo-tv-delay/up.sql b/migrations/2023-11-01-135902_game-flo-tv-delay/up.sql new file mode 100644 index 00000000..b25cc258 --- /dev/null +++ b/migrations/2023-11-01-135902_game-flo-tv-delay/up.sql @@ -0,0 +1,2 @@ +alter table "game" + add column flo_tv_delay_override_secs integer; \ No newline at end of file