mod database; mod error; use chrono::{DateTime, Utc}; use id::UserID; use serde::Serialize; pub use crate::error::Error; #[derive(Serialize, Debug, Clone)] 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, timezone: String, } 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 } pub fn timezone(&self) -> &str { &self.timezone } pub fn updated_at(&self) -> DateTime { self.updated_at } }