use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use sqlx::FromRow; use uuid::Uuid; /// A "like" on an article. Composite PK (article, user). #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, FromRow)] pub struct ArticleLikeModel { pub article: Uuid, pub user: Uuid, pub created_at: DateTime, } /// A comment on an article. Supports nested replies via `parent`. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, FromRow)] pub struct ArticleCommentModel { pub id: Uuid, pub article: Uuid, pub author: Uuid, pub parent: Option, pub content: String, pub created_at: DateTime, pub updated_at: DateTime, pub deleted_at: Option>, } /// Payload for creating a comment. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct CreateCommentPayload { pub content: String, pub parent: Option, } /// Paginated comment list. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ArticleCommentList { pub comments: Vec, pub total: i64, } /// API representation of a comment with author info. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ArticleCommentItem { pub id: Uuid, pub article: Uuid, pub parent: Option, pub content: String, pub author: Uuid, pub created_at: DateTime, pub updated_at: DateTime, }