diff options
| -rw-r--r-- | src/domain/event.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/domain/event.rs b/src/domain/event.rs index 93216a4..0772020 100644 --- a/src/domain/event.rs +++ b/src/domain/event.rs @@ -79,32 +79,32 @@ impl Event { pub fn cancel(&mut self) { self.is_cancelled = true; - self.updated_at = Utc::now(); + self.touch(); } pub fn restore(&mut self) { self.is_cancelled = false; - self.updated_at = Utc::now(); + self.touch(); } pub fn update_title(&mut self, title: String) { self.title = title; - self.updated_at = Utc::now(); + self.touch(); } pub fn update_description(&mut self, description: Option<String>) { self.description = description; - self.updated_at = Utc::now(); + self.touch(); } pub fn update_time_range(&mut self, time_range: TimeRange) { self.time_range = time_range; - self.updated_at = Utc::now(); + self.touch(); } pub fn update_color(&mut self, color: EventColor) { self.color = color; - self.updated_at = Utc::now(); + self.touch(); } pub fn overlaps_with(&self, other: &Event) -> bool { @@ -113,4 +113,8 @@ impl Event { && self.calendar_id == other.calendar_id && self.time_range.overlaps(other.time_range()) } + + pub fn touch(&mut self) { + self.updated_at = Utc::now(); + } } |