From 1b0bb911a026d1f1514f2e3d1a4889cf076323a3 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Fri, 15 May 2026 03:35:58 +0200 Subject: [PATCH] feat(domain): add federation management methods to FederationActionPort --- .../adapters/activitypub-base/src/service.rs | 45 +++++++++++++++++++ crates/domain/src/ports.rs | 23 ++++++++++ crates/domain/src/testing.rs | 45 +++++++++++++++++++ 3 files changed, 113 insertions(+) diff --git a/crates/adapters/activitypub-base/src/service.rs b/crates/adapters/activitypub-base/src/service.rs index b7dc1c1..7ab81ee 100644 --- a/crates/adapters/activitypub-base/src/service.rs +++ b/crates/adapters/activitypub-base/src/service.rs @@ -1769,6 +1769,51 @@ impl domain::ports::FederationActionPort for ActivityPubService { }) .collect() } + + async fn get_pending_followers( + &self, + _user_id: &domain::value_objects::UserId, + ) -> Result, domain::errors::DomainError> { + Ok(vec![]) + } + + async fn accept_follow_request( + &self, + _user_id: &domain::value_objects::UserId, + _actor_url: &str, + ) -> Result<(), domain::errors::DomainError> { + Ok(()) + } + + async fn reject_follow_request( + &self, + _user_id: &domain::value_objects::UserId, + _actor_url: &str, + ) -> Result<(), domain::errors::DomainError> { + Ok(()) + } + + async fn get_remote_followers( + &self, + _user_id: &domain::value_objects::UserId, + ) -> Result, domain::errors::DomainError> { + Ok(vec![]) + } + + async fn remove_remote_follower( + &self, + _user_id: &domain::value_objects::UserId, + _actor_url: &str, + ) -> Result<(), domain::errors::DomainError> { + Ok(()) + } + + async fn get_remote_following( + &self, + _user_id: &domain::value_objects::UserId, + ) -> Result, domain::errors::DomainError> { + Ok(vec![]) + } } #[cfg(test)] diff --git a/crates/domain/src/ports.rs b/crates/domain/src/ports.rs index c2db885..2831aef 100644 --- a/crates/domain/src/ports.rs +++ b/crates/domain/src/ports.rs @@ -228,6 +228,29 @@ pub trait FederationActionPort: Send + Sync { local_user_id: &UserId, handle: &str, ) -> Result<(), DomainError>; + async fn get_pending_followers( + &self, + user_id: &UserId, + ) -> Result, DomainError>; + async fn accept_follow_request( + &self, + user_id: &UserId, + actor_url: &str, + ) -> Result<(), DomainError>; + async fn reject_follow_request( + &self, + user_id: &UserId, + actor_url: &str, + ) -> Result<(), DomainError>; + async fn get_remote_followers(&self, user_id: &UserId) + -> Result, DomainError>; + async fn remove_remote_follower( + &self, + user_id: &UserId, + actor_url: &str, + ) -> Result<(), DomainError>; + async fn get_remote_following(&self, user_id: &UserId) + -> Result, DomainError>; async fn actor_json(&self, user_id: &UserId) -> Result; async fn followers_collection_json( &self, diff --git a/crates/domain/src/testing.rs b/crates/domain/src/testing.rs index a1031b3..31234ef 100644 --- a/crates/domain/src/testing.rs +++ b/crates/domain/src/testing.rs @@ -556,6 +556,51 @@ impl FederationActionPort for TestStore { Ok(()) } + async fn get_pending_followers( + &self, + _user_id: &UserId, + ) -> Result, DomainError> { + Ok(vec![]) + } + + async fn accept_follow_request( + &self, + _user_id: &UserId, + _actor_url: &str, + ) -> Result<(), DomainError> { + Ok(()) + } + + async fn reject_follow_request( + &self, + _user_id: &UserId, + _actor_url: &str, + ) -> Result<(), DomainError> { + Ok(()) + } + + async fn get_remote_followers( + &self, + _user_id: &UserId, + ) -> Result, DomainError> { + Ok(vec![]) + } + + async fn remove_remote_follower( + &self, + _user_id: &UserId, + _actor_url: &str, + ) -> Result<(), DomainError> { + Ok(()) + } + + async fn get_remote_following( + &self, + _user_id: &UserId, + ) -> Result, DomainError> { + Ok(vec![]) + } + async fn actor_json(&self, _user_id: &UserId) -> Result { Err(DomainError::NotFound) }