Skip to main content

tail_fin_xhs/
types.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct Note {
5    pub id: String,
6    pub title: String,
7    pub content: String,
8    pub author: String,
9    pub author_id: String,
10    pub likes: u64,
11    pub collects: u64,
12    pub comments: u64,
13    pub shares: u64,
14    pub tags: Vec<String>,
15    pub images: Vec<String>,
16    pub video: Option<String>,
17    pub published_at: String,
18    pub note_type: String,
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct SearchNote {
23    pub id: String,
24    pub title: String,
25    pub author: String,
26    pub likes: u64,
27    pub published_at: String,
28    pub url: String,
29    pub cover_image: Option<String>,
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct Comment {
34    pub author: String,
35    pub text: String,
36    pub likes: u64,
37    pub time: String,
38    pub replies: Vec<Comment>,
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize)]
42pub struct UserNote {
43    pub id: String,
44    pub title: String,
45    pub likes: u64,
46    pub note_type: String,
47    pub cover_image: Option<String>,
48    pub published_at: String,
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct MediaItem {
53    pub media_type: String,
54    pub url: String,
55}
56
57#[derive(Debug, Clone, Serialize, Deserialize)]
58pub struct FeedItem {
59    pub id: String,
60    pub title: String,
61    pub author: String,
62    pub likes: u64,
63    pub note_type: String,
64    pub url: String,
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
68pub struct Notification {
69    pub notification_type: String,
70    pub user: String,
71    pub content: String,
72    pub time: String,
73    pub target_note_id: Option<String>,
74}