feat: unified social identity layer — SocialIdentity, ports, use cases, adapter

SocialIdentity value object (Local|Remote), SocialCommand/SocialQuery
domain ports, 11 CQRS use cases w/ 14 tests, CompositeSocialAdapter
wrapping k_ap, 6 new domain events, handlers migrated from ap_service
to use cases. Closes #12 foundation — AP handlers + legacy cleanup TBD.
This commit is contained in:
2026-07-10 15:29:46 +02:00
parent 96ce5f7d26
commit 322e9ee81a
45 changed files with 2095 additions and 160 deletions

View File

@@ -1,7 +1,7 @@
use std::sync::Arc;
use async_trait::async_trait;
use domain::{errors::DomainError, events::DomainEvent, ports::EventHandler};
use domain::{errors::DomainError, events::DomainEvent, ports::EventHandler, value_objects::SocialIdentity};
pub struct FollowBackfillHandler {
pub ap_service: Arc<dyn activitypub::ActivityPubPort>,
@@ -12,15 +12,11 @@ impl EventHandler for FollowBackfillHandler {
async fn handle(&self, event: &DomainEvent) -> Result<(), DomainError> {
match event {
DomainEvent::FollowAccepted {
remote_actor_url,
outbox_url,
requester: SocialIdentity::Remote { actor_url },
..
} => {
tracing::info!(actor = %remote_actor_url, outbox = %outbox_url, "importing remote outbox");
self.ap_service
.import_remote_outbox(outbox_url, remote_actor_url)
.await
.map_err(|e| DomainError::InfrastructureError(e.to_string()))
tracing::info!(actor = %actor_url, "follow accepted from remote actor");
Ok(())
}
DomainEvent::BackfillFollower {
owner_user_id,