23 lines
488 B
Rust
23 lines
488 B
Rust
use crate::authentication::Role;
|
|
use chrono::{DateTime, Utc};
|
|
use uuid::Uuid;
|
|
|
|
pub struct UserEntry {
|
|
pub user_id: Uuid,
|
|
pub username: String,
|
|
pub role: Role,
|
|
pub full_name: Option<String>,
|
|
pub bio: Option<String>,
|
|
pub member_since: DateTime<Utc>,
|
|
}
|
|
|
|
impl UserEntry {
|
|
pub fn formatted_date(&self) -> String {
|
|
self.member_since.format("%B %d, %Y").to_string()
|
|
}
|
|
|
|
pub fn is_admin(&self) -> bool {
|
|
matches!(self.role, Role::Admin)
|
|
}
|
|
}
|