aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/routes/bots.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-01-01 11:26:49 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-01-01 11:26:49 +0100
commite145947d052450618af3ba094e66a27c3c7f86e4 (patch)
tree5aff15f6ffb98710323b0ebadb58f733e75cbead /planetwars-server/src/routes/bots.rs
parent8d3b8fd8aa9603f5377f1b37963190ac2c01e9dd (diff)
downloadplanetwars.dev-e145947d052450618af3ba094e66a27c3c7f86e4.tar.xz
planetwars.dev-e145947d052450618af3ba094e66a27c3c7f86e4.zip
match form stubs
Diffstat (limited to 'planetwars-server/src/routes/bots.rs')
-rw-r--r--planetwars-server/src/routes/bots.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/planetwars-server/src/routes/bots.rs b/planetwars-server/src/routes/bots.rs
index f722e52..8327443 100644
--- a/planetwars-server/src/routes/bots.rs
+++ b/planetwars-server/src/routes/bots.rs
@@ -58,6 +58,12 @@ pub async fn get_my_bots(
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
}
+pub async fn list_bots(conn: DatabaseConnection) -> Result<Json<Vec<Bot>>, StatusCode> {
+ bots::find_all_bots(&conn)
+ .map(Json)
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
+}
+
// TODO: currently this only implements the happy flow
pub async fn upload_code_multipart(
conn: DatabaseConnection,