From 66753e22752f3e4468c2c1ffcc8cf8b06a172576 Mon Sep 17 00:00:00 2001 From: Clover Johnson <95094165+callmeclover@users.noreply.github.com> Date: Thu, 25 Apr 2024 08:13:33 -0400 Subject: [PATCH] fix --- src/user/auth.rs | 2 +- src/user/model.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/user/auth.rs b/src/user/auth.rs index 526c500e..d936a9bc 100644 --- a/src/user/auth.rs +++ b/src/user/auth.rs @@ -34,7 +34,7 @@ impl DatabaseConnectix { /// Gets a possible user id (if one exists) for a username. pub fn get_user_id(&self, name: &str) -> Result> { - if let Some(res) = self.connection.query_one("select max(id) from users where name=$1", &[&name]) { + if let Some(res) = Some(self.connection.query_one("select max(id) from users where name=$1", &[&name])?) { if res.id == 9999 { return Err("username is taken".into()); } Ok(res.id+1) } else { diff --git a/src/user/model.rs b/src/user/model.rs index 33b2c277..ddef1810 100644 --- a/src/user/model.rs +++ b/src/user/model.rs @@ -55,10 +55,10 @@ impl From for Model { fn from(item: User) -> Self { let (name, id) = item.name_split(); Self { - id.parse::().unwrap(), - name.to_string(), + id: id.parse::().unwrap(), + name: name.to_string(), uuid: item.uuid, - moderation_stats: item.glass + moderation_stats: Json(item.glass) } } }