aboutsummaryrefslogtreecommitdiffstats
path: root/adenosine-pds/src/web.rs
blob: 81e62be5f12e3d1f1c3b461daac8bad4cbd42a98 (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

use adenosine_cli::identifiers::{Did, Nsid, Tid};
use serde_json;
use askama::Template;
use crate::repo::RepoCommit;
use crate::models::*;

#[derive(Template)]
#[template(path = "home.html")]
pub struct GenericHomeView {
    pub domain: String,
}

#[derive(Template)]
#[template(path = "about.html")]
pub struct AboutView {
    pub domain: String,
}

#[derive(Template)]
#[template(path = "profile.html")]
pub struct ProfileView {
    pub domain: String,
    pub did: Did,
    pub profile: serde_json::Value,
    pub feed: Vec<serde_json::Value>,
}

#[derive(Template)]
#[template(path = "post.html")]
pub struct PostView {
    pub domain: String,
    pub did: Did,
    pub collection: Nsid,
    pub tid: Tid,
    pub post_text: String,
    pub post_created_at: String,
}

#[derive(Template)]
#[template(path = "at_repo.html")]
pub struct RepoView {
    pub domain: String,
    pub did: Did,
    pub commit: RepoCommit,
    pub describe: RepoDescribe,
}

#[derive(Template)]
#[template(path = "at_collection.html")]
pub struct CollectionView {
    pub domain: String,
    pub did: Did,
    pub collection: Nsid,
    pub records: Vec<serde_json::Value>,
}

#[derive(Template)]
#[template(path = "at_record.html")]
pub struct RecordView {
    pub domain: String,
    pub did: Did,
    pub collection: Nsid,
    pub tid: Tid,
    pub record: serde_json::Value,
}