mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-01-09 12:12:27 +00:00
49 lines
1.1 KiB
Rust
49 lines
1.1 KiB
Rust
use crate::utils::user_data_utils::user_data_url;
|
|
|
|
///! User information
|
|
///!
|
|
///! @author Pierre Hubert
|
|
|
|
pub type UserID = i64;
|
|
|
|
#[derive(Debug, PartialEq)]
|
|
pub enum UserPageStatus {
|
|
OPEN,
|
|
PUBLIC,
|
|
PRIVATE
|
|
}
|
|
|
|
#[derive(Debug, PartialEq)]
|
|
#[allow(non_camel_case_types)]
|
|
pub enum AccountImageVisibility {
|
|
FRIENDS,
|
|
COMUNIC_USERS,
|
|
EVERYONE
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct User {
|
|
pub id: UserID,
|
|
pub email: String,
|
|
pub password: String,
|
|
pub first_name: String,
|
|
pub last_name: String,
|
|
pub status: UserPageStatus,
|
|
pub virtual_directory: Option<String>,
|
|
pub account_image_path: Option<String>,
|
|
pub account_image_visibility: AccountImageVisibility,
|
|
}
|
|
|
|
impl User {
|
|
|
|
/// Get the URL pointing to the default account image
|
|
pub fn default_account_image_url() -> String {
|
|
user_data_url(crate::constants::DEFAULT_ACCOUNT_IMAGE)
|
|
}
|
|
|
|
/// Get the URL pointing to the error account image, when the user is not allowed to see user
|
|
/// account image
|
|
pub fn error_account_image_url() -> String {
|
|
user_data_url(crate::constants::ERROR_ACCOUNT_IMAGE)
|
|
}
|
|
} |