refactor(ports): CQRS split — FederationActionPort into four focused sub-ports

This commit is contained in:
2026-05-15 13:49:58 +02:00
parent 8ed7f3d5bc
commit 189901b778
6 changed files with 155 additions and 95 deletions

View File

@@ -6,8 +6,9 @@ use domain::{
remote_actor::RemoteActor,
},
ports::{
ActivityPubRepository, EventPublisher, FederationActionPort, FederationSchedulerPort,
FeedRepository, FollowRepository, RemoteActorConnectionRepository, UserReader,
ActivityPubRepository, EventPublisher, FederationActionPort, FederationFollowPort,
FederationFollowRequestPort, FederationSchedulerPort, FeedRepository, FollowRepository,
RemoteActorConnectionRepository, UserReader,
},
value_objects::UserId,
};
@@ -15,14 +16,14 @@ use domain::{
use super::social;
pub async fn list_pending_requests(
federation: &dyn FederationActionPort,
federation: &dyn FederationFollowRequestPort,
user_id: &UserId,
) -> Result<Vec<RemoteActor>, DomainError> {
federation.get_pending_followers(user_id).await
}
pub async fn accept_follow_request(
federation: &dyn FederationActionPort,
federation: &dyn FederationFollowRequestPort,
user_id: &UserId,
actor_url: &str,
) -> Result<(), DomainError> {
@@ -30,7 +31,7 @@ pub async fn accept_follow_request(
}
pub async fn reject_follow_request(
federation: &dyn FederationActionPort,
federation: &dyn FederationFollowRequestPort,
user_id: &UserId,
actor_url: &str,
) -> Result<(), DomainError> {
@@ -38,14 +39,14 @@ pub async fn reject_follow_request(
}
pub async fn list_remote_followers(
federation: &dyn FederationActionPort,
federation: &dyn FederationFollowRequestPort,
user_id: &UserId,
) -> Result<Vec<RemoteActor>, DomainError> {
federation.get_remote_followers(user_id).await
}
pub async fn remove_remote_follower(
federation: &dyn FederationActionPort,
federation: &dyn FederationFollowRequestPort,
user_id: &UserId,
actor_url: &str,
) -> Result<(), DomainError> {
@@ -53,7 +54,7 @@ pub async fn remove_remote_follower(
}
pub async fn list_remote_following(
federation: &dyn FederationActionPort,
federation: &dyn FederationFollowPort,
user_id: &UserId,
) -> Result<Vec<RemoteActor>, DomainError> {
federation.get_remote_following(user_id).await
@@ -62,7 +63,7 @@ pub async fn list_remote_following(
pub async fn remove_remote_following(
follows: &dyn FollowRepository,
users: &dyn UserReader,
federation: &dyn FederationActionPort,
federation: &dyn FederationFollowPort,
events: &dyn EventPublisher,
user_id: &UserId,
handle: &str,

View File

@@ -4,7 +4,7 @@ use domain::{
events::DomainEvent,
models::social::{Block, Boost, Follow, FollowState, Like},
ports::{
BlockRepository, BoostRepository, EventPublisher, FederationActionPort, FollowRepository,
BlockRepository, BoostRepository, EventPublisher, FederationFollowPort, FollowRepository,
LikeRepository, UserReader,
},
value_objects::{BoostId, LikeId, ThoughtId, UserId, Username},
@@ -93,7 +93,7 @@ pub async fn unboost_thought(
pub async fn follow_actor(
follows: &dyn FollowRepository,
users: &dyn UserReader,
federation: &dyn FederationActionPort,
federation: &dyn FederationFollowPort,
events: &dyn EventPublisher,
follower_id: &UserId,
username: &str,
@@ -140,7 +140,7 @@ pub async fn follow_user(
pub async fn unfollow_actor(
follows: &dyn FollowRepository,
users: &dyn UserReader,
federation: &dyn FederationActionPort,
federation: &dyn FederationFollowPort,
events: &dyn EventPublisher,
follower_id: &UserId,
username: &str,