From 4e24495b159df0dbc4f503843c08ccd452af616a Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Tue, 30 May 2023 21:48:26 +0100 Subject: WIP: blog --- src/main.rs | 5 +++-- src/posts/mod.rs | 33 +++++++++++++++++++++++++++++++++ src/posts/note.rs | 1 + 3 files changed, 37 insertions(+), 2 deletions(-) (limited to 'src') 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 { + id: i64, + created_at: DateTime, + updated_at: Option>, + post_type: PostType, + media: Option>>, + content: Option, + tags: Vec, +} + +pub trait Content { + fn render(&self) -> String; +} + +// impl Post { +// // renders as internal html (must sanitize) +// fn new(type: PostType, ) -> Post { +// } +// } 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 -- cgit