- 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
70 lines
1.7 KiB
Rust
70 lines
1.7 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use sqlx::FromRow;
|
|
use uuid::Uuid;
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, FromRow)]
|
|
pub struct ChannelArticleModel {
|
|
pub id: Uuid,
|
|
pub channel: Uuid,
|
|
pub author: Uuid,
|
|
pub title: String,
|
|
pub cover_url: Option<String>,
|
|
pub content: String,
|
|
pub content_type: String,
|
|
pub summary: Option<String>,
|
|
#[serde(default)]
|
|
pub tags: Vec<String>,
|
|
pub is_pinned: bool,
|
|
pub view_count: i64,
|
|
pub like_count: i64,
|
|
pub comment_count: i64,
|
|
pub status: String,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
pub deleted_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct CreateArticlePayload {
|
|
pub channel: Uuid,
|
|
pub title: String,
|
|
pub cover_url: Option<String>,
|
|
pub content: String,
|
|
pub content_type: Option<String>,
|
|
pub summary: Option<String>,
|
|
pub tags: Option<Vec<String>>,
|
|
pub status: Option<String>,
|
|
}
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct UpdateArticlePayload {
|
|
pub title: Option<String>,
|
|
pub cover_url: Option<String>,
|
|
pub content: Option<String>,
|
|
pub content_type: Option<String>,
|
|
pub summary: Option<String>,
|
|
pub tags: Option<Vec<String>>,
|
|
pub is_pinned: Option<bool>,
|
|
pub status: Option<String>,
|
|
}
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
|
|
pub struct ChannelArticleCard {
|
|
pub id: Uuid,
|
|
pub channel: Uuid,
|
|
pub author: Uuid,
|
|
pub title: String,
|
|
pub cover_url: Option<String>,
|
|
pub summary: Option<String>,
|
|
pub tags: Vec<String>,
|
|
pub like_count: i64,
|
|
pub comment_count: i64,
|
|
pub view_count: i64,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|