mod database; mod error; use chrono::{DateTime, Utc}; use id::UserID; pub use crate::error::Error; #[derive(Debug)] pub struct User { id: UserID, created_at: DateTime, updated_at: DateTime, is_admin: bool, username: String, name: Option, email: Option, password: Option, password_recover: Option, paper_key: Option, is_archived: bool, } impl User { pub fn id(&self) -> &UserID { &self.id } pub fn is_archived(&self) -> bool { self.is_archived } pub fn password_hashed(&self) -> Option<&str> { self.password.as_deref() } pub fn username(&self) -> &str { &self.username } pub fn name(&self) -> Option<&str> { self.name.as_deref() } pub fn email(&self) -> Option<&str> { self.email.as_deref() } pub fn is_admin(&self) -> bool { self.is_admin } }