refactor: eliminate User/UserResponse struct literals, add AP user tests
- Feed/search adapters use #[sqlx(flatten)] UserRow instead of inline User construction — single point of change when User gains fields - User::new_remote constructor replaces struct literal in testing - to_summary_response replaces inline UserResponse in get_users - 5 integration tests for PgApUserRepository (find, count, profile_fields→attachment)
This commit is contained in:
@@ -52,4 +52,23 @@ impl User {
|
||||
updated_at: now,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_remote(id: UserId, username: Username, email: Email) -> Self {
|
||||
let now = Utc::now();
|
||||
Self {
|
||||
id,
|
||||
username,
|
||||
email,
|
||||
password_hash: PasswordHash(String::new()),
|
||||
display_name: None,
|
||||
bio: None,
|
||||
avatar_url: None,
|
||||
header_url: None,
|
||||
custom_css: None,
|
||||
profile_fields: vec![],
|
||||
local: false,
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user