diff options
author | cel 🌸 <cel@blos.sm> | 2023-05-30 21:48:26 +0100 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2023-05-30 21:48:26 +0100 |
commit | 4e24495b159df0dbc4f503843c08ccd452af616a (patch) | |
tree | 9834c93fe714713b5305dbb46561d8e7154c142a /src | |
parent | c6378ca77f08a8aaf30fa25c4c02d151bf69edfa (diff) | |
download | blossom-4e24495b159df0dbc4f503843c08ccd452af616a.tar.gz blossom-4e24495b159df0dbc4f503843c08ccd452af616a.tar.bz2 blossom-4e24495b159df0dbc4f503843c08ccd452af616a.zip |
WIP: blog
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 5 | ||||
-rw-r--r-- | src/posts/mod.rs | 33 | ||||
-rw-r--r-- | src/posts/note.rs | 1 |
3 files changed, 37 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 8ad4bf4..833a7ae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,11 +3,12 @@ use rocket::fs::{relative, FileServer}; use rocket::http::Status; use rocket::State; use rocket::{Build, Request, Rocket}; -use rocket_db_pools::sqlx::{self, database}; -use rocket_db_pools::{Connection, Database}; +use rocket_db_pools::sqlx; +use rocket_db_pools::Database; use rocket_dyn_templates::{context, Template}; use std::borrow::Cow; +mod posts; mod scrobbles; mod skweets; diff --git a/src/posts/mod.rs b/src/posts/mod.rs index e69de29..b0c3749 100644 --- a/src/posts/mod.rs +++ b/src/posts/mod.rs @@ -0,0 +1,33 @@ +use chrono::{DateTime, Utc}; +use std::path::Path; + +enum PostType { + Article, + Note, +} + +enum TextFormat { + Markdown, + Plaintext, + Html, +} + +pub struct Post<T: Content> { + id: i64, + created_at: DateTime<Utc>, + updated_at: Option<DateTime<Utc>>, + post_type: PostType, + media: Option<Vec<Box<Path>>>, + content: Option<T>, + tags: Vec<String>, +} + +pub trait Content { + fn render(&self) -> String; +} + +// impl<T> Post<T> { +// // renders as internal html (must sanitize) +// fn new(type: PostType, ) -> Post<T> { +// } +// } diff --git a/src/posts/note.rs b/src/posts/note.rs index e69de29..95655d4 100644 --- a/src/posts/note.rs +++ b/src/posts/note.rs @@ -0,0 +1 @@ +struct note |