diff options
Diffstat (limited to 'src/channel')
| -rw-r--r-- | src/channel/event.rs | 3 | ||||
| -rw-r--r-- | src/channel/history.rs | 2 | ||||
| -rw-r--r-- | src/channel/snapshot.rs | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/channel/event.rs b/src/channel/event.rs index 9c54174..9f2e263 100644 --- a/src/channel/event.rs +++ b/src/channel/event.rs @@ -27,6 +27,7 @@ pub enum Kind { #[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)] pub struct Created { + #[serde(flatten)] pub channel: Channel, } @@ -38,7 +39,7 @@ impl From<Created> for Kind { #[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)] pub struct Deleted { - pub channel: channel::Id, + pub id: channel::Id, } impl From<Deleted> for Kind { diff --git a/src/channel/history.rs b/src/channel/history.rs index 383fb7b..0499927 100644 --- a/src/channel/history.rs +++ b/src/channel/history.rs @@ -53,7 +53,7 @@ impl History { self.deleted.map(|instant| Event { instant, kind: Deleted { - channel: self.channel.id.clone(), + id: self.channel.id.clone(), } .into(), }) diff --git a/src/channel/snapshot.rs b/src/channel/snapshot.rs index 6462f25..afef2fb 100644 --- a/src/channel/snapshot.rs +++ b/src/channel/snapshot.rs @@ -13,7 +13,7 @@ impl Channel { fn apply(state: Option<Self>, event: Event) -> Option<Self> { match (state, event.kind) { (None, Kind::Created(event)) => Some(event.into()), - (Some(channel), Kind::Deleted(event)) if channel.id == event.channel => None, + (Some(channel), Kind::Deleted(event)) if channel.id == event.id => None, (state, event) => panic!("invalid channel event {event:#?} for state {state:#?}"), } } |
