aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-02-16 18:40:32 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-02-16 18:40:32 +0100
commit4dc77e16263a701169b48187251dde7e375c9206 (patch)
tree85669b5ab2e798bb51f093cf5dcfea3f91dedeb6 /planetwars-server
parentebd01757e8676c081b318e67283dd56089a7db6b (diff)
downloadplanetwars.dev-4dc77e16263a701169b48187251dde7e375c9206.tar.xz
planetwars.dev-4dc77e16263a701169b48187251dde7e375c9206.zip
add MatchState to ApiMatch
Diffstat (limited to 'planetwars-server')
-rw-r--r--planetwars-server/src/db_types.rs3
-rw-r--r--planetwars-server/src/routes/matches.rs2
2 files changed, 4 insertions, 1 deletions
diff --git a/planetwars-server/src/db_types.rs b/planetwars-server/src/db_types.rs
index d1225d7..1b99e49 100644
--- a/planetwars-server/src/db_types.rs
+++ b/planetwars-server/src/db_types.rs
@@ -1,6 +1,7 @@
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"]
pub enum MatchState {
diff --git a/planetwars-server/src/routes/matches.rs b/planetwars-server/src/routes/matches.rs
index 44c8607..f2599cd 100644
--- a/planetwars-server/src/routes/matches.rs
+++ b/planetwars-server/src/routes/matches.rs
@@ -101,6 +101,7 @@ async fn run_match_task(
pub struct ApiMatch {
id: i32,
timestamp: chrono::NaiveDateTime,
+ state: MatchState,
players: Vec<ApiMatchPlayer>,
}
@@ -119,6 +120,7 @@ pub fn match_data_to_api(data: matches::MatchData) -> ApiMatch {
ApiMatch {
id: data.base.id,
timestamp: data.base.created_at,
+ state: data.base.state,
players: data
.match_players
.iter()