From a15e3d580124f561864c6a39f1e035eb1b3aab13 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Mon, 30 Jun 2025 22:00:57 -0400 Subject: Rename "channel" to "conversation" within the server. I've split this from the schema and API changes because, frankly, it's huge. Annoyingly so. There are no semantic changes in this, it's all symbol changes, but there are a _lot_ of them because the term "channel" leaks all over everything in a service whose primary role is managing messages sent to channels (now, conversations). I found a buggy test while working on this! It's not fixed in this commit, because it felt mean to hide a real change in the middle of this much chaff. --- src/conversation/event.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/conversation/event.rs (limited to 'src/conversation/event.rs') diff --git a/src/conversation/event.rs b/src/conversation/event.rs new file mode 100644 index 0000000..f5e8a81 --- /dev/null +++ b/src/conversation/event.rs @@ -0,0 +1,46 @@ +use super::Conversation; +use crate::{ + conversation, + event::{Instant, Sequenced}, +}; + +#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)] +#[serde(tag = "event", rename_all = "snake_case")] +pub enum Event { + Created(Created), + Deleted(Deleted), +} + +impl Sequenced for Event { + fn instant(&self) -> Instant { + match self { + Self::Created(event) => event.conversation.created, + Self::Deleted(event) => event.instant, + } + } +} + +#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)] +pub struct Created { + #[serde(flatten)] + pub conversation: Conversation, +} + +impl From for Event { + fn from(event: Created) -> Self { + Self::Created(event) + } +} + +#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)] +pub struct Deleted { + #[serde(flatten)] + pub instant: Instant, + pub id: conversation::Id, +} + +impl From for Event { + fn from(event: Deleted) -> Self { + Self::Deleted(event) + } +} -- cgit v1.2.3