aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/category.rs8
-rw-r--r--src/model/event.rs3
-rw-r--r--src/model/mod.rs1
3 files changed, 12 insertions, 0 deletions
diff --git a/src/model/category.rs b/src/model/category.rs
new file mode 100644
index 0000000..2f65671
--- /dev/null
+++ b/src/model/category.rs
@@ -0,0 +1,8 @@
+use uuid::Uuid;
+
+#[derive(Debug, Clone)]
+pub struct Category {
+ pub id: Uuid,
+ pub name: String,
+ pub color: String,
+}
diff --git a/src/model/event.rs b/src/model/event.rs
index e556f6e..6cc16a2 100644
--- a/src/model/event.rs
+++ b/src/model/event.rs
@@ -16,6 +16,7 @@ pub struct Event {
pub end: Option<NaiveTime>,
pub name: String,
pub repetition: Option<Repetition>,
+ pub category: Option<Uuid>,
}
impl Event {
@@ -62,6 +63,7 @@ pub fn validate(
start: String,
end: String,
repetition: Option<Repetition>,
+ category: Option<Uuid>,
) -> Option<Event> {
let start = validation::time(start)?;
let end = validation::time(end)?;
@@ -78,5 +80,6 @@ pub fn validate(
start,
end,
repetition,
+ category,
})
}
diff --git a/src/model/mod.rs b/src/model/mod.rs
index 0aefbc6..2491bb4 100644
--- a/src/model/mod.rs
+++ b/src/model/mod.rs
@@ -1,3 +1,4 @@
+pub mod category;
pub mod event;
pub mod repetition;
pub mod time;