diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2021-12-30 23:40:37 +0100 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2021-12-30 23:40:37 +0100 |
commit | f5e8b4093a1527967423a3af70f2b95d4b05008f (patch) | |
tree | fd000cd7689e54b9efc73f2913ec4d1817c098b0 /planetwars-server/src/db | |
parent | c6ca7cf2d1238c05f75a53934ea2f6c91efc3646 (diff) | |
download | planetwars.dev-f5e8b4093a1527967423a3af70f2b95d4b05008f.tar.xz planetwars.dev-f5e8b4093a1527967423a3af70f2b95d4b05008f.zip |
prototype bots pages
Diffstat (limited to 'planetwars-server/src/db')
-rw-r--r-- | planetwars-server/src/db/bots.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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<Bot> { bots::table.find(id).first(conn) } +pub fn find_bots_by_owner(owner_id: i32, conn: &PgConnection) -> QueryResult<Vec<Bot>> { + bots::table + .filter(bots::owner_id.eq(owner_id)) + .get_results(conn) +} + #[derive(Insertable)] #[table_name = "code_bundles"] pub struct NewCodeBundle<'a> { |