structural refactor and codebase improvements

This commit is contained in:
2026-08-09 14:58:14 +02:00
parent 22b1dd3f56
commit c9715baab8
247 changed files with 11515 additions and 3063 deletions

View File

@@ -0,0 +1,31 @@
use domain::errors::DomainError;
use domain::models::FederatedProfile;
use uuid::Uuid;
use crate::users::deps::GetFederatedProfileDeps;
/// Looks up a federated (remote) profile by synthetic user id — the fallback
/// path `get_user_profile` (`handlers/users.rs`) takes when the local-profile
/// lookup comes back `NotFound`.
///
/// Federation being disabled (`deps.federated_profile` is `None`) collapses to
/// `Ok(None)`, the same value a present-but-empty lookup would return. That's
/// deliberate: the handler's `if let Ok(Some(fed)) = ...` treats "port absent",
/// "call returned `Ok(None)`", and "call returned `Err`" identically — all three
/// fall through to a 404 — and this use case must not make any of those three
/// distinguishable to a caller that cannot act on the difference. An `Err` from
/// the port is propagated unchanged; the swallow stays at the handler, exactly
/// where it already was.
pub async fn execute(
deps: &GetFederatedProfileDeps,
user_id: Uuid,
) -> Result<Option<FederatedProfile>, DomainError> {
match &deps.federated_profile {
Some(fed_query) => fed_query.get_federated_profile(user_id).await,
None => Ok(None),
}
}
#[cfg(test)]
#[path = "tests/get_federated_profile.rs"]
mod tests;