post_archiver/comment.rs
1use serde::{Deserialize, Serialize};
2#[cfg(feature = "typescript")]
3use ts_rs::TS;
4
5/// A user comment that can be attached to a post with support for nested replies
6#[cfg_attr(feature = "typescript", derive(TS))]
7#[cfg_attr(feature = "typescript", ts(export))]
8#[derive(Deserialize, Serialize, Debug, Clone, Hash, PartialEq, Eq)]
9pub struct Comment {
10 pub user: String,
11 pub text: String,
12 #[cfg_attr(feature = "typescript", ts(as = "Option<Vec<Comment>>", optional))]
13 #[serde(skip_serializing_if = "<[_]>::is_empty", default)]
14 pub replies: Vec<Comment>,
15}