feat: add FollowAccepted domain event

This commit is contained in:
2026-05-13 01:17:26 +02:00
parent 7c08e4a942
commit 80983f1ff2

View File

@@ -56,6 +56,11 @@ pub enum DomainEvent {
user_id: UserId, user_id: UserId,
movie_id: MovieId, movie_id: MovieId,
}, },
FollowAccepted {
local_user_id: UserId,
remote_actor_url: String,
outbox_url: String,
},
} }
#[async_trait] #[async_trait]
@@ -82,3 +87,23 @@ impl EventEnvelope {
self.ack.nack().await self.ack.nack().await
} }
} }
#[cfg(test)]
mod tests {
use super::*;
use crate::value_objects::UserId;
#[test]
fn follow_accepted_matches() {
let uid = UserId::from_uuid(uuid::Uuid::new_v4());
let event = DomainEvent::FollowAccepted {
local_user_id: uid.clone(),
remote_actor_url: "https://remote.example/users/alice".to_string(),
outbox_url: "https://remote.example/users/alice/outbox".to_string(),
};
let DomainEvent::FollowAccepted { outbox_url, .. } = event else {
panic!("wrong variant");
};
assert_eq!(outbox_url, "https://remote.example/users/alice/outbox");
}
}