diff --git a/crates/adapters/event-payload/src/lib.rs b/crates/adapters/event-payload/src/lib.rs index 53fa98b..7ed869f 100644 --- a/crates/adapters/event-payload/src/lib.rs +++ b/crates/adapters/event-payload/src/lib.rs @@ -71,6 +71,18 @@ pub enum EventPayload { ProfileUpdated { user_id: String, }, + RemoteFollowAccepted { + local_user_id: String, + remote_actor_url: String, + }, + RemoteFollowRejected { + local_user_id: String, + remote_actor_url: String, + }, + ActorMoved { + user_id: String, + new_actor_url: String, + }, MentionReceived { thought_id: String, mentioned_user_id: String, @@ -97,6 +109,9 @@ impl EventPayload { Self::UserUnblocked { .. } => "users.unblocked", Self::UserRegistered { .. } => "users.registered", Self::ProfileUpdated { .. } => "users.profile_updated", + Self::RemoteFollowAccepted { .. } => "federation.remote_follow_accepted", + Self::RemoteFollowRejected { .. } => "federation.remote_follow_rejected", + Self::ActorMoved { .. } => "federation.actor_moved", Self::MentionReceived { .. } => "mentions.received", } } @@ -210,6 +225,27 @@ impl From<&DomainEvent> for EventPayload { DomainEvent::ProfileUpdated { user_id } => Self::ProfileUpdated { user_id: user_id.to_string(), }, + DomainEvent::RemoteFollowAccepted { + local_user_id, + remote_actor_url, + } => Self::RemoteFollowAccepted { + local_user_id: local_user_id.to_string(), + remote_actor_url: remote_actor_url.clone(), + }, + DomainEvent::RemoteFollowRejected { + local_user_id, + remote_actor_url, + } => Self::RemoteFollowRejected { + local_user_id: local_user_id.to_string(), + remote_actor_url: remote_actor_url.clone(), + }, + DomainEvent::ActorMoved { + user_id, + new_actor_url, + } => Self::ActorMoved { + user_id: user_id.to_string(), + new_actor_url: new_actor_url.clone(), + }, DomainEvent::MentionReceived { thought_id, mentioned_user_id, @@ -340,6 +376,27 @@ impl TryFrom for DomainEvent { EventPayload::ProfileUpdated { user_id } => DomainEvent::ProfileUpdated { user_id: UserId::from_uuid(parse_uuid(&user_id, "user_id")?), }, + EventPayload::RemoteFollowAccepted { + local_user_id, + remote_actor_url, + } => DomainEvent::RemoteFollowAccepted { + local_user_id: UserId::from_uuid(parse_uuid(&local_user_id, "local_user_id")?), + remote_actor_url, + }, + EventPayload::RemoteFollowRejected { + local_user_id, + remote_actor_url, + } => DomainEvent::RemoteFollowRejected { + local_user_id: UserId::from_uuid(parse_uuid(&local_user_id, "local_user_id")?), + remote_actor_url, + }, + EventPayload::ActorMoved { + user_id, + new_actor_url, + } => DomainEvent::ActorMoved { + user_id: UserId::from_uuid(parse_uuid(&user_id, "user_id")?), + new_actor_url, + }, EventPayload::MentionReceived { thought_id, mentioned_user_id, diff --git a/crates/adapters/postgres/src/outbox.rs b/crates/adapters/postgres/src/outbox.rs index a24f6bb..8fd1e9a 100644 --- a/crates/adapters/postgres/src/outbox.rs +++ b/crates/adapters/postgres/src/outbox.rs @@ -32,6 +32,9 @@ fn aggregate_id(event: &DomainEvent) -> Uuid { DomainEvent::UserUnblocked { blocker_id, .. } => blocker_id.as_uuid(), DomainEvent::UserRegistered { user_id } => user_id.as_uuid(), DomainEvent::ProfileUpdated { user_id } => user_id.as_uuid(), + DomainEvent::RemoteFollowAccepted { local_user_id, .. } => local_user_id.as_uuid(), + DomainEvent::RemoteFollowRejected { local_user_id, .. } => local_user_id.as_uuid(), + DomainEvent::ActorMoved { user_id, .. } => user_id.as_uuid(), DomainEvent::MentionReceived { thought_id, .. } => thought_id.as_uuid(), } } diff --git a/crates/domain/src/events.rs b/crates/domain/src/events.rs index 81382bc..e35bb8c 100644 --- a/crates/domain/src/events.rs +++ b/crates/domain/src/events.rs @@ -63,6 +63,18 @@ pub enum DomainEvent { ProfileUpdated { user_id: UserId, }, + RemoteFollowAccepted { + local_user_id: UserId, + remote_actor_url: String, + }, + RemoteFollowRejected { + local_user_id: UserId, + remote_actor_url: String, + }, + ActorMoved { + user_id: UserId, + new_actor_url: String, + }, MentionReceived { thought_id: ThoughtId, mentioned_user_id: UserId,