aboutsummaryrefslogtreecommitdiffstats
path: root/src/posts/mod.rs
blob: b0c3749409ec121fa8a0fe5633fed69dbfa968d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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> {
//     }
// }