relay filter/appview bootstrap
1use serde::Serialize;
2
3use super::Record;
4
5#[derive(Debug, Serialize)]
6pub struct InviteView {
7 pub uri: String,
8 pub cid: String,
9 pub author: String,
10 pub channel: String,
11 pub recipient: String,
12 #[serde(rename = "createdAt")]
13 pub created_at: String,
14 #[serde(rename = "indexedAt")]
15 pub indexed_at: String,
16}
17
18impl From<Record> for InviteView {
19 fn from(r: Record) -> Self {
20 let channel_cid = r.ref_cids.first().cloned().unwrap_or_default();
21 Self {
22 uri: r.uri,
23 cid: r.cid,
24 author: r.creator_did,
25 channel: channel_cid,
26 recipient: r.target_did.unwrap_or_default(),
27 created_at: r.created_at.to_rfc3339(),
28 indexed_at: r.indexed_at.to_rfc3339(),
29 }
30 }
31}