From a971d8c2dc519b1db805c72cf3395c188a98dff4 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Wed, 13 Dec 2023 06:50:44 +0000 Subject: switch to uuids --- src/users.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/users.rs') diff --git a/src/users.rs b/src/users.rs index 4cf9310..e8b0b67 100644 --- a/src/users.rs +++ b/src/users.rs @@ -1,12 +1,14 @@ use bcrypt::hash; use bcrypt::verify; use bcrypt::DEFAULT_COST; +use uuid::Uuid; use crate::Privacy; use crate::Result; #[derive(sqlx::FromRow)] pub struct User { + pub id: Uuid, pub username: String, pub password: String, pub email: Option, @@ -19,7 +21,9 @@ pub struct User { impl User { pub fn new(username: String, password: String) -> Result { let password_hash = hash(password, DEFAULT_COST)?; + let id = Uuid::new_v4(); Ok(Self { + id, username, password: password_hash, email: None, -- cgit