add winner to match api responses

This commit is contained in:
Ilion Beyst 2022-07-31 21:04:13 +02:00
parent e8dbb01933
commit 15c1aa9d59

View file

@ -14,6 +14,7 @@ pub struct ApiMatch {
timestamp: chrono::NaiveDateTime, timestamp: chrono::NaiveDateTime,
state: MatchState, state: MatchState,
players: Vec<ApiMatchPlayer>, players: Vec<ApiMatchPlayer>,
winner: Option<i32>,
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
@ -45,6 +46,7 @@ pub fn match_data_to_api(data: matches::FullMatchData) -> ApiMatch {
bot_name: _p.bot.as_ref().map(|b| b.name.clone()), bot_name: _p.bot.as_ref().map(|b| b.name.clone()),
}) })
.collect(), .collect(),
winner: data.base.winner,
} }
} }