From 15c1aa9d592acdc3c9c6feb710b1b116f1d78d89 Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Sun, 31 Jul 2022 21:04:13 +0200
Subject: [PATCH] add winner to match api responses

---
 planetwars-server/src/routes/matches.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/planetwars-server/src/routes/matches.rs b/planetwars-server/src/routes/matches.rs
index 0a4b56a..03f6653 100644
--- a/planetwars-server/src/routes/matches.rs
+++ b/planetwars-server/src/routes/matches.rs
@@ -14,6 +14,7 @@ pub struct ApiMatch {
     timestamp: chrono::NaiveDateTime,
     state: MatchState,
     players: Vec<ApiMatchPlayer>,
+    winner: Option<i32>,
 }
 
 #[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()),
             })
             .collect(),
+        winner: data.base.winner,
     }
 }