aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/db/sessions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'planetwars-server/src/db/sessions.rs')
-rw-r--r--planetwars-server/src/db/sessions.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/planetwars-server/src/db/sessions.rs b/planetwars-server/src/db/sessions.rs
index a91d954..f8108cc 100644
--- a/planetwars-server/src/db/sessions.rs
+++ b/planetwars-server/src/db/sessions.rs
@@ -6,7 +6,7 @@ use diesel::{insert_into, prelude::*, Insertable, RunQueryDsl};
use rand::{self, Rng};
#[derive(Insertable)]
-#[table_name = "sessions"]
+#[diesel(table_name = sessions)]
struct NewSession {
token: String,
user_id: i32,
@@ -19,7 +19,7 @@ pub struct Session {
pub token: String,
}
-pub fn create_session(user: &User, conn: &PgConnection) -> Session {
+pub fn create_session(user: &User, conn: &mut PgConnection) -> Session {
let new_session = NewSession {
token: gen_session_token(),
user_id: user.id,
@@ -31,7 +31,7 @@ pub fn create_session(user: &User, conn: &PgConnection) -> Session {
.unwrap()
}
-pub fn find_user_by_session(token: &str, conn: &PgConnection) -> QueryResult<(Session, User)> {
+pub fn find_user_by_session(token: &str, conn: &mut PgConnection) -> QueryResult<(Session, User)> {
sessions::table
.inner_join(users::table)
.filter(sessions::token.eq(&token))