feat(worker): handle FetchRemoteActorPosts — fetch and store remote outbox notes

This commit is contained in:
2026-05-14 22:23:20 +02:00
parent f3c3637ade
commit dc3afeca26
3 changed files with 74 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ use std::sync::Arc;
use activitypub::ThoughtsObjectHandler;
use activitypub_base::ActivityPubService;
use application::services::{FederationEventService, NotificationEventService};
use domain::ports::{ActivityPubRepository, FederationActionPort, OutboundFederationPort};
use postgres::activitypub::PgActivityPubRepository;
use postgres_federation::{PostgresApUserRepository, PostgresFederationRepository};
@@ -34,7 +35,7 @@ pub async fn build(
));
// ActivityPub service (for federation fan-out)
let ap_service: Arc<dyn domain::ports::OutboundFederationPort> = Arc::new(
let ap_service = Arc::new(
ActivityPubService::new(
Arc::new(PostgresFederationRepository::new(pool.clone())),
Arc::new(PostgresApUserRepository::new(
@@ -54,6 +55,10 @@ pub async fn build(
.await
.expect("ActivityPubService build failed"),
);
let ap_outbound = ap_service.clone() as Arc<dyn OutboundFederationPort>;
let ap_federation = ap_service.clone() as Arc<dyn FederationActionPort>;
let ap_repo_worker =
Arc::new(PgActivityPubRepository::new(pool.clone())) as Arc<dyn ActivityPubRepository>;
// Application services
let notification_svc = Arc::new(NotificationEventService {
@@ -63,8 +68,10 @@ pub async fn build(
let federation_svc = Arc::new(FederationEventService {
thoughts,
users,
ap: ap_service,
ap: ap_outbound,
base_url: base_url.to_string(),
federation_action: ap_federation,
ap_repo: ap_repo_worker,
});
// Thin handlers