1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use crate::domain;
use cqrs_core::Event;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Created {
pub initial_description: domain::Description,
}
impl Event for Created {
fn event_type(&self) -> &'static str {
"todo_created"
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DescriptionUpdated {
pub new_description: domain::Description,
}
impl Event for DescriptionUpdated {
fn event_type(&self) -> &'static str {
"todo_description_updated"
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ReminderUpdated {
pub new_reminder: Option<domain::Reminder>,
}
impl Event for ReminderUpdated {
fn event_type(&self) -> &'static str {
"todo_reminder_updated"
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Completed {}
impl Event for Completed {
fn event_type(&self) -> &'static str {
"todo_completed"
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Uncompleted {}
impl Event for Uncompleted {
fn event_type(&self) -> &'static str {
"todo_uncompleted"
}
}