aboutsummaryrefslogtreecommitdiff
path: root/src/modules/blog/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/blog/config.rs')
-rw-r--r--src/modules/blog/config.rs65
1 files changed, 15 insertions, 50 deletions
diff --git a/src/modules/blog/config.rs b/src/modules/blog/config.rs
index c4c7ced..a061b7f 100644
--- a/src/modules/blog/config.rs
+++ b/src/modules/blog/config.rs
@@ -1,53 +1,18 @@
-use {
- serde::{Deserialize, Serialize},
- std::collections::HashMap,
-};
-
-#[derive(Serialize, Deserialize, Clone, Default)]
-pub struct Entry {
- description: Option<String>,
- author: Option<String>,
- created: Option<String>,
- last_modified: Option<String>,
- name: Option<String>,
-}
-impl Entry {
- pub const fn description(&self) -> Option<&String> {
- self.description.as_ref()
- }
-
- pub const fn author(&self) -> Option<&String> { self.author.as_ref() }
-
- pub const fn name(&self) -> Option<&String> { self.name.as_ref() }
-
- pub const fn created(&self) -> Option<&String> { self.created.as_ref() }
-
- pub const fn last_modified(&self) -> Option<&String> {
- self.last_modified.as_ref()
- }
+#[derive(Clone)]
+pub struct BlogCategory {
+ pub title: String,
+ pub description: Option<String>,
+ pub priority: u8,
+ pub notion_id: String,
}
-#[derive(Serialize, Deserialize, Clone, Default)]
-pub struct Blog {
- name: Option<String>,
- description: Option<String>,
- posts: Option<HashMap<String, Entry>>,
- priority: Option<u8>,
-}
-impl Blog {
- pub const fn description(&self) -> Option<&String> {
- self.description.as_ref()
- }
-
- pub const fn name(&self) -> Option<&String> { self.name.as_ref() }
-
- pub const fn posts(&self) -> Option<&HashMap<String, Entry>> {
- self.posts.as_ref()
- }
-
- pub const fn priority(&self) -> Option<&u8> { self.priority.as_ref() }
-
- pub fn from_string(string: &str) -> serde_json::Result<Self> {
- serde_json::from_str(string)
- }
+#[derive(Clone)]
+pub struct BlogPost {
+ pub title: String,
+ pub description: Option<String>,
+ pub author: Option<String>,
+ pub created: Option<String>,
+ pub last_modified: Option<String>,
+ pub content: String,
+ pub blog_id: String,
}