Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
callmeclover committed Apr 25, 2024
1 parent 66666cf commit 66753e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/user/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32, Box<dyn Error>> {
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 {
Expand Down
6 changes: 3 additions & 3 deletions src/user/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ impl From<User> for Model {
fn from(item: User) -> Self {
let (name, id) = item.name_split();
Self {
id.parse::<i32>().unwrap(),
name.to_string(),
id: id.parse::<i32>().unwrap(),
name: name.to_string(),
uuid: item.uuid,
moderation_stats: item.glass
moderation_stats: Json(item.glass)
}
}
}
Expand Down

0 comments on commit 66753e2

Please sign in to comment.