aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/db/users.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-07-24 16:45:29 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-07-24 16:45:29 +0200
commitccfe86729e3a454e3fdf529abd7063ceb8fa859f (patch)
tree0c60dfbc76c1e2c2ba6c71a5201fde18690969f5 /planetwars-server/src/db/users.rs
parent33664eff2c93136658b7f863c95e1bfda91141ee (diff)
downloadplanetwars.dev-ccfe86729e3a454e3fdf529abd7063ceb8fa859f.tar.xz
planetwars.dev-ccfe86729e3a454e3fdf529abd7063ceb8fa859f.zip
add bot detail page
Diffstat (limited to 'planetwars-server/src/db/users.rs')
-rw-r--r--planetwars-server/src/db/users.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/planetwars-server/src/db/users.rs b/planetwars-server/src/db/users.rs
index 1098204..ebb2268 100644
--- a/planetwars-server/src/db/users.rs
+++ b/planetwars-server/src/db/users.rs
@@ -57,6 +57,12 @@ pub fn create_user(credentials: &Credentials, conn: &PgConnection) -> QueryResul
.get_result::<User>(conn)
}
+pub fn find_user(user_id: i32, db_conn: &PgConnection) -> QueryResult<User> {
+ users::table
+ .filter(users::id.eq(user_id))
+ .first::<User>(db_conn)
+}
+
pub fn find_user_by_name(username: &str, db_conn: &PgConnection) -> QueryResult<User> {
users::table
.filter(users::username.eq(username))