aboutsummaryrefslogtreecommitdiffstats
path: root/src/poetry.rs
blob: f5f194c3d5e0dc533506c072fe1169d5db29a36b (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use chrono::{DateTime, Utc};

use crate::posts::Post;

pub struct Poem {
    file_name: String,
    title: Option<String>,
    created_at: DateTime<Utc>,
    published_at: DateTime<Utc>,
    updated_at: Option<DateTime<Utc>>,
    content: String,
    // TODO: localisation (get lang from file names)
    lang: String,
}

impl Post for Poem {
    fn id(&self) -> &str {
        &self.file_name
    }

    fn subject(&self) -> Option<&str> {
        self.title.as_deref()
    }

    fn published_at(&self) -> &DateTime<Utc> {
        &self.published_at
    }

    fn updated_at(&self) -> Option<&DateTime<Utc>> {
        self.updated_at.as_ref()
    }

    fn tags(&self) -> &Vec<String> {
        todo!()
    }

    fn lang(&self) -> &str {
        "en"
    }

    fn post_type(&self) -> crate::posts::PostType {
        todo!()
    }

    fn content(&self) -> &str {
        todo!()
    }
}