From f5e8b4093a1527967423a3af70f2b95d4b05008f Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Thu, 30 Dec 2021 23:40:37 +0100 Subject: prototype bots pages --- planetwars-server/src/db/bots.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'planetwars-server/src/db') diff --git a/planetwars-server/src/db/bots.rs b/planetwars-server/src/db/bots.rs index bc9cb11..d21d9dc 100644 --- a/planetwars-server/src/db/bots.rs +++ b/planetwars-server/src/db/bots.rs @@ -28,6 +28,12 @@ pub fn find_bot(id: i32, conn: &PgConnection) -> QueryResult { bots::table.find(id).first(conn) } +pub fn find_bots_by_owner(owner_id: i32, conn: &PgConnection) -> QueryResult> { + bots::table + .filter(bots::owner_id.eq(owner_id)) + .get_results(conn) +} + #[derive(Insertable)] #[table_name = "code_bundles"] pub struct NewCodeBundle<'a> { -- cgit v1.2.3