Compare commits

..
Author SHA1 Message Date
phoenix 04eaa1dff1 Added UserProfile
Release Tagging / release (pull_request) Successful in 37s
Rust Build / Check (pull_request) Failing after 38s
Rust Build / Test Suite (pull_request) Failing after 35s
Rust Build / Rustfmt (pull_request) Successful in 34s
Rust Build / Clippy (pull_request) Failing after 39s
Rust Build / build (pull_request) Failing after 41s
2026-05-29 22:08:53 -04:00
phoenix 179a550034 Adding Login history (#9)
Release Tagging / release (push) Failing after 36s
Rust Build / Check (push) Successful in 46s
Rust Build / Test Suite (push) Successful in 39s
Rust Build / Rustfmt (push) Successful in 32s
Rust Build / Clippy (push) Successful in 33s
Rust Build / build (push) Successful in 33s
Reviewed-on: phoenix/textsender-models#9
2026-05-29 21:41:40 -04:00
phoenix a8e173d831 ServiceUser (#8)
Release Tagging / release (push) Successful in 29s
Rust Build / Check (push) Successful in 39s
Rust Build / Test Suite (push) Successful in 25s
Rust Build / Rustfmt (push) Successful in 27s
Rust Build / Clippy (push) Successful in 28s
Rust Build / build (push) Successful in 26s
Reviewed-on: phoenix/textsender-models#8
2026-05-29 10:02:51 -04:00
+41
View File
@@ -21,8 +21,49 @@ pub struct ServiceUser {
pub id: uuid::Uuid,
pub username: String,
pub passphrase: String,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
// When serializing to json, if empty do not populate
#[serde(with = "time::serde::rfc3339::option")]
pub last_login: Option<time::OffsetDateTime>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UserLoginHistory {
pub id: uuid::Uuid,
#[serde(with = "time::serde::rfc3339::option")]
pub login_time: Option<time::OffsetDateTime>,
pub user_id: uuid::Uuid,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ServiceUserLoginHistory {
pub id: uuid::Uuid,
#[serde(with = "time::serde::rfc3339::option")]
pub login_time: Option<time::OffsetDateTime>,
pub service_user_id: uuid::Uuid,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UserProfile {
pub user_id: uuid::Uuid,
pub phone_number: String,
pub username: String,
pub firstname: String,
pub lastname: String,
pub created: Option<time::OffsetDateTime>,
pub last_login: Option<time::OffsetDateTime>,
}
pub fn init_user_profile(usr: &User) -> UserProfile {
let mut usrProfile = UserProfile::default();
usrProfile.user_id = usr.id.clone();
usrProfile.phone_number = usr.phone_number.clone();
usrProfile.username = usr.username.clone();
usrProfile.firstname = usr.firstname.clone();
usrProfile.lastname = usr.lastname.clone();
usrProfile.created = usr.created.clone();
usrProfile.last_login = usr.last_login.clone();
return usrProfile;
}