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:
2026-05-29 14:17:41 +02:00
parent 020a79704f
commit 6d0b1a3121
10 changed files with 160 additions and 107 deletions

View File

@@ -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,
}
}
}