- Add ArticleFeed component for article-based channels - Implement ArticleComposer with draft persistence - Add Newspaper icon for article room type - Update ChannelPage to conditionally render article feed vs message view - Add article-related API endpoints and models - Reset thread view when switching rooms - Add room type check in channel sidebar - Update CSS to hide scrollbars globally - Add gRPC message size limit configuration - Fix git diff tree handling
52 lines
1.4 KiB
Rust
52 lines
1.4 KiB
Rust
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<Utc>,
|
|
}
|
|
|
|
/// 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<Uuid>,
|
|
pub content: String,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
pub deleted_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
/// Payload for creating a comment.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct CreateCommentPayload {
|
|
pub content: String,
|
|
pub parent: Option<Uuid>,
|
|
}
|
|
|
|
/// Paginated comment list.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ArticleCommentList {
|
|
pub comments: Vec<ArticleCommentItem>,
|
|
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<Uuid>,
|
|
pub content: String,
|
|
pub author: Uuid,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|