add MatchState to ApiMatch
This commit is contained in:
parent
ebd01757e8
commit
4dc77e1626
2 changed files with 4 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
use diesel_derive_enum::DbEnum;
|
use diesel_derive_enum::DbEnum;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(DbEnum, Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(DbEnum, Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)]
|
||||||
#[DieselType = "Match_state"]
|
#[DieselType = "Match_state"]
|
||||||
|
|
||||||
pub enum MatchState {
|
pub enum MatchState {
|
||||||
|
|
|
@ -101,6 +101,7 @@ async fn run_match_task(
|
||||||
pub struct ApiMatch {
|
pub struct ApiMatch {
|
||||||
id: i32,
|
id: i32,
|
||||||
timestamp: chrono::NaiveDateTime,
|
timestamp: chrono::NaiveDateTime,
|
||||||
|
state: MatchState,
|
||||||
players: Vec<ApiMatchPlayer>,
|
players: Vec<ApiMatchPlayer>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +120,7 @@ pub fn match_data_to_api(data: matches::MatchData) -> ApiMatch {
|
||||||
ApiMatch {
|
ApiMatch {
|
||||||
id: data.base.id,
|
id: data.base.id,
|
||||||
timestamp: data.base.created_at,
|
timestamp: data.base.created_at,
|
||||||
|
state: data.base.state,
|
||||||
players: data
|
players: data
|
||||||
.match_players
|
.match_players
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Reference in a new issue