From d907bf99a227cc405ac982cf6f3276737f3c4a1e Mon Sep 17 00:00:00 2001 From: phoenix Date: Fri, 29 May 2026 22:42:49 -0400 Subject: [PATCH 1/3] Added test --- src/user/mod.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/user/mod.rs b/src/user/mod.rs index 5a25302..fa9d435 100644 --- a/src/user/mod.rs +++ b/src/user/mod.rs @@ -66,3 +66,24 @@ pub fn init_user_profile(usr: &User) -> UserProfile { last_login: usr.last_login, } } + +#[cfg(test)] +mod tests { + #[test] + fn test_init_user_profile() { + let usr = super::User { + id: uuid::Uuid::new_v4(), + phone_number: String::from("+12308438462"), + username: String::from("Cowboy99"), + password: String::from("238n7cyr2q89d3xhe2"), + firstname: String::from("BillyBob"), + lastname: String::from("Jones"), + created: Some(time::OffsetDateTime::now_utc()), + last_login: Some(time::OffsetDateTime::now_utc()), + ..Default::default() + }; + + let profile = super::init_user_profile(&usr); + assert_eq!(usr.phone_number, profile.phone_number, "Phone numbers are not equal"); + } +} -- 2.47.3 From 38bf53e05ec6df5be587802d9ea74abd83654aed Mon Sep 17 00:00:00 2001 From: phoenix Date: Fri, 29 May 2026 22:47:46 -0400 Subject: [PATCH 2/3] Added Organization --- src/user/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/user/mod.rs b/src/user/mod.rs index fa9d435..ba0d30a 100644 --- a/src/user/mod.rs +++ b/src/user/mod.rs @@ -28,6 +28,15 @@ pub struct ServiceUser { pub last_login: Option, } +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct Organization { + pub id: uuid::Uuid, + pub name: String, + #[serde(with = "time::serde::rfc3339::option")] + pub created: Option, +} + + #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct UserLoginHistory { pub id: uuid::Uuid, @@ -44,6 +53,7 @@ pub struct ServiceUserLoginHistory { pub service_user_id: uuid::Uuid, } + #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct UserProfile { pub user_id: uuid::Uuid, @@ -51,7 +61,9 @@ pub struct UserProfile { pub username: String, pub firstname: String, pub lastname: String, + #[serde(with = "time::serde::rfc3339::option")] pub created: Option, + #[serde(with = "time::serde::rfc3339::option")] pub last_login: Option, } @@ -67,6 +79,7 @@ pub fn init_user_profile(usr: &User) -> UserProfile { } } + #[cfg(test)] mod tests { #[test] -- 2.47.3 From 1c3c9924254b64ee0951af3e59d521041828b51a Mon Sep 17 00:00:00 2001 From: phoenix Date: Fri, 29 May 2026 22:49:04 -0400 Subject: [PATCH 3/3] cargo fmt --- src/user/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/user/mod.rs b/src/user/mod.rs index ba0d30a..9f883d6 100644 --- a/src/user/mod.rs +++ b/src/user/mod.rs @@ -36,7 +36,6 @@ pub struct Organization { pub created: Option, } - #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct UserLoginHistory { pub id: uuid::Uuid, @@ -53,7 +52,6 @@ pub struct ServiceUserLoginHistory { pub service_user_id: uuid::Uuid, } - #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct UserProfile { pub user_id: uuid::Uuid, @@ -79,7 +77,6 @@ pub fn init_user_profile(usr: &User) -> UserProfile { } } - #[cfg(test)] mod tests { #[test] @@ -97,6 +94,9 @@ mod tests { }; let profile = super::init_user_profile(&usr); - assert_eq!(usr.phone_number, profile.phone_number, "Phone numbers are not equal"); + assert_eq!( + usr.phone_number, profile.phone_number, + "Phone numbers are not equal" + ); } } -- 2.47.3