- Thought::new_local → NewThought struct (7 args → 1) - UserWriter::update_profile → UpdateProfileInput struct (6 args → 2) - update_profile use case → UpdateProfileInput (8 args → 3) - ActivityPubService::new → builder pattern (9 args → 5 required + 4 optional setters) - accept_note → AcceptNoteInput struct (8 args → 1) - ThoughtNote::new_public → ThoughtNoteInput struct (8 args → 1) Remove all #[allow(clippy::too_many_arguments)] annotations.
53 lines
1.3 KiB
Rust
53 lines
1.3 KiB
Rust
use crate::value_objects::{Email, PasswordHash, UserId, Username};
|
|
use chrono::{DateTime, Utc};
|
|
|
|
#[derive(Debug, Default, Clone)]
|
|
pub struct UpdateProfileInput {
|
|
pub display_name: Option<String>,
|
|
pub bio: Option<String>,
|
|
pub avatar_url: Option<String>,
|
|
pub header_url: Option<String>,
|
|
pub custom_css: Option<String>,
|
|
}
|
|
|
|
#[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 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,
|
|
created_at: now,
|
|
updated_at: now,
|
|
}
|
|
}
|
|
}
|