Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 6m49s
test / unit (pull_request) Successful in 16m24s
test / integration (pull_request) Failing after 17m7s
- Reorganized imports in health, notifications, social, thoughts, and users handlers for clarity. - Updated function signatures in handlers to improve readability by aligning parameters. - Enhanced JSON response formatting in notifications and thoughts handlers. - Improved error handling in user-related functions. - Refactored OpenAPI documentation to maintain consistent formatting and structure. - Cleaned up unnecessary code and comments across various files. - Ensured consistent use of `Arc` for shared state in AppState and WorkerHandlers.
52 lines
1.3 KiB
Rust
52 lines
1.3 KiB
Rust
use crate::value_objects::{Email, PasswordHash, UserId, Username};
|
|
use chrono::{DateTime, Utc};
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct User {
|
|
pub id: UserId,
|
|
pub username: Username,
|
|
pub email: Email,
|
|
pub password_hash: PasswordHash,
|
|
pub display_name: Option<String>,
|
|
pub bio: Option<String>,
|
|
pub avatar_url: Option<String>,
|
|
pub header_url: Option<String>,
|
|
pub custom_css: Option<String>,
|
|
pub local: bool,
|
|
pub ap_id: Option<String>,
|
|
pub inbox_url: Option<String>,
|
|
pub public_key: Option<String>,
|
|
pub private_key: Option<String>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|
|
|
|
impl User {
|
|
pub fn new_local(
|
|
id: UserId,
|
|
username: Username,
|
|
email: Email,
|
|
password_hash: PasswordHash,
|
|
) -> Self {
|
|
let now = Utc::now();
|
|
Self {
|
|
id,
|
|
username,
|
|
email,
|
|
password_hash,
|
|
display_name: None,
|
|
bio: None,
|
|
avatar_url: None,
|
|
header_url: None,
|
|
custom_css: None,
|
|
local: true,
|
|
ap_id: None,
|
|
inbox_url: None,
|
|
public_key: None,
|
|
private_key: None,
|
|
created_at: now,
|
|
updated_at: now,
|
|
}
|
|
}
|
|
}
|