129 lines
3.1 KiB
Rust
129 lines
3.1 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::id::ContentId;
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
|
|
pub enum UserRole {
|
|
User,
|
|
Admin,
|
|
Banned,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
|
|
pub enum ContentStatus {
|
|
Staged,
|
|
Active,
|
|
Deleted,
|
|
Blacklisted,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
|
|
pub enum ReportStatus {
|
|
Open,
|
|
Dismissed,
|
|
Actioned,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct User {
|
|
pub id: i64,
|
|
pub telegram_username: Option<String>,
|
|
pub first_name: String,
|
|
pub role: UserRole,
|
|
pub accepted_terms_at: Option<DateTime<Utc>>,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct Content {
|
|
pub id: ContentId,
|
|
pub user_id: i64,
|
|
pub status: ContentStatus,
|
|
pub view_count: u64,
|
|
pub max_views: Option<u64>,
|
|
pub allow_download: bool,
|
|
pub password_hash: Option<String>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub deleted_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct ContentFile {
|
|
pub content_id: ContentId,
|
|
pub file_index: u32,
|
|
pub original_name: String,
|
|
pub stored_path: std::path::PathBuf,
|
|
pub mime_type: String,
|
|
pub size_bytes: u64,
|
|
pub ciphertext_size_bytes: u64,
|
|
pub encrypted_key_wrapped: Vec<u8>,
|
|
pub encrypted_hash: Vec<u8>,
|
|
pub render_flags: u32,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct Report {
|
|
pub id: i64,
|
|
pub content_id: ContentId,
|
|
pub reporter_user_id: i64,
|
|
pub reason: String,
|
|
pub status: ReportStatus,
|
|
pub created_at: DateTime<Utc>,
|
|
pub resolved_at: Option<DateTime<Utc>>,
|
|
pub resolver_id: Option<i64>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct AdminAction {
|
|
pub id: i64,
|
|
pub admin_user_id: i64,
|
|
pub target_type: String,
|
|
pub target_id: String,
|
|
pub action: String,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct ForwardDefinition {
|
|
pub id: i64,
|
|
pub creator_user_id: i64,
|
|
pub source_chat_id: i64,
|
|
pub destination_chat_id: i64,
|
|
pub review_group_id: i64,
|
|
pub forward_message: String,
|
|
pub code: String,
|
|
pub share_mode: String,
|
|
pub revoked_at: Option<DateTime<Utc>>,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct ForwardSubmission {
|
|
pub id: i64,
|
|
pub forward_id: i64,
|
|
pub user_id: i64,
|
|
pub content_id: ContentId,
|
|
pub status: String,
|
|
pub review_message_id: Option<i32>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub resolved_at: Option<DateTime<Utc>>,
|
|
pub resolver_id: Option<i64>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Punishment {
|
|
pub id: i64,
|
|
pub chat_id: i64,
|
|
pub target_user_id: i64,
|
|
pub action_type: String,
|
|
pub duration_seconds: Option<i64>,
|
|
pub reason: Option<String>,
|
|
pub created_by: i64,
|
|
pub created_at: String,
|
|
pub revoked_at: Option<String>,
|
|
pub revoked_by: Option<i64>,
|
|
pub active: bool,
|
|
}
|