diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-02-26 23:07:13 +0100 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-02-27 14:51:32 +0100 |
commit | 6ef6a872fe3bbe389e92145b39fd88d864f6a790 (patch) | |
tree | 6db40ec6f0cb91b9262aabaa3c4134a680a8803c /planetwars-server/src/routes | |
parent | 29bd21e489cdda2aaf807c66198f112f8ac0f7d5 (diff) | |
download | planetwars.dev-6ef6a872fe3bbe389e92145b39fd88d864f6a790.tar.xz planetwars.dev-6ef6a872fe3bbe389e92145b39fd88d864f6a790.zip |
make bot owner nullable
Diffstat (limited to 'planetwars-server/src/routes')
-rw-r--r-- | planetwars-server/src/routes/bots.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/planetwars-server/src/routes/bots.rs b/planetwars-server/src/routes/bots.rs index 5f5d8f5..0edfaa9 100644 --- a/planetwars-server/src/routes/bots.rs +++ b/planetwars-server/src/routes/bots.rs @@ -24,7 +24,7 @@ pub async fn create_bot( params: Json<BotParams>, ) -> (StatusCode, Json<Bot>) { let bot_params = bots::NewBot { - owner_id: user.id, + owner_id: Some(user.id), name: ¶ms.name, }; let bot = bots::create_bot(&bot_params, &conn).unwrap(); @@ -71,7 +71,7 @@ pub async fn upload_code_multipart( let bot = bots::find_bot(bot_id, &conn).map_err(|_| StatusCode::NOT_FOUND)?; - if user.id != bot.owner_id { + if Some(user.id) != bot.owner_id { return Err(StatusCode::FORBIDDEN); } |