summaryrefslogtreecommitdiff
path: root/src/conversation/snapshot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/snapshot.rs')
-rw-r--r--src/conversation/snapshot.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/conversation/snapshot.rs b/src/conversation/snapshot.rs
index da9eaae..440f3c0 100644
--- a/src/conversation/snapshot.rs
+++ b/src/conversation/snapshot.rs
@@ -1,8 +1,10 @@
+use serde_with::with_prefix;
+
use super::{
Id,
event::{Created, Event},
};
-use crate::{clock::DateTime, event::Instant, name::Name};
+use crate::{event::Instant, name::Name};
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)]
pub struct Conversation {
@@ -10,10 +12,16 @@ pub struct Conversation {
pub created: Instant,
pub id: Id,
pub name: Name,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub deleted_at: Option<DateTime>,
+ #[serde(
+ flatten,
+ with = "prefix_deleted",
+ skip_serializing_if = "Option::is_none"
+ )]
+ pub deleted: Option<Instant>,
}
+with_prefix!(prefix_deleted "deleted_");
+
impl Conversation {
fn apply(state: Option<Self>, event: Event) -> Option<Self> {
match (state, event) {