relay filter/appview bootstrap
1use serde::Serialize;
2
3use super::Record;
4
5#[derive(Debug, Serialize)]
6pub struct LatticeView {
7 pub uri: String,
8 pub cid: String,
9 pub author: String,
10 pub description: Option<String>,
11 #[serde(rename = "createdAt")]
12 pub created_at: String,
13 #[serde(rename = "indexedAt")]
14 pub indexed_at: String,
15}
16
17impl From<Record> for LatticeView {
18 fn from(r: Record) -> Self {
19 Self {
20 uri: r.uri,
21 cid: r.cid,
22 author: r.creator_did,
23 description: r.data.get("description").and_then(|v| v.as_str()).map(String::from),
24 created_at: r.created_at.to_rfc3339(),
25 indexed_at: r.indexed_at.to_rfc3339(),
26 }
27 }
28}