//! Media, build pipeline, mailing list, custom domain, import, and S3 key models. use chrono::{DateTime, Utc}; use serde::Serialize; use sqlx::FromRow; use super::super::id_types::*; use super::super::validated_types::*; // ── Media Library models ── /// A user-scoped media file for embedding in markdown content. #[derive(Debug, Clone, FromRow)] pub struct DbMediaFile { pub id: MediaFileId, pub user_id: UserId, pub folder: String, pub filename: String, pub s3_key: String, pub content_type: String, pub file_size_bytes: i64, pub media_type: String, pub scan_status: String, pub created_at: DateTime, } // ── Build Pipeline models ── /// A build pipeline configuration linking a sync app to a git repo. #[derive(Debug, Clone, FromRow)] pub struct DbBuildConfig { pub id: BuildConfigId, pub app_id: SyncAppId, pub repo_id: GitRepoId, pub build_command: String, pub artifact_path: String, pub signing_key_path: String, pub targets: Vec, pub enabled: bool, pub created_at: DateTime, pub updated_at: DateTime, } /// A single build execution triggered by a tag or manual action. #[derive(Debug, Clone, FromRow)] pub struct DbBuild { pub id: BuildId, pub config_id: BuildConfigId, pub app_id: SyncAppId, pub version: String, pub tag: String, pub status: super::super::BuildStatus, pub started_at: Option>, pub finished_at: Option>, pub log: String, pub error_message: Option, pub release_id: Option, pub triggered_by: String, pub created_at: DateTime, } // ── Mailing List models ── /// A per-project mailing list (content, devlog, or patches). #[derive(Debug, Clone, FromRow)] pub struct DbMailingList { pub id: MailingListId, pub project_id: ProjectId, pub list_type: super::super::MailingListType, pub name: String, pub description: Option, pub created_at: DateTime, } /// A subscription to a mailing list. #[derive(Debug, Clone, FromRow)] pub struct DbMailingListSubscriber { pub id: MailingListSubscriberId, pub list_id: MailingListId, pub user_id: UserId, pub subscribed_at: DateTime, } // ── Custom Domain models ── /// A custom domain configured for a creator's profile. #[derive(Debug, Clone, FromRow)] pub struct DbCustomDomain { pub id: CustomDomainId, pub user_id: UserId, pub domain: String, pub verified: bool, pub verification_token: String, pub created_at: DateTime, pub verified_at: Option>, } // ── Import Job models ── /// A data import job (CSV/JSON from external platforms). #[derive(Debug, Clone, FromRow, Serialize)] pub struct DbImportJob { pub id: ImportJobId, pub user_id: UserId, pub project_id: ProjectId, pub source: super::super::ImportSource, pub status: super::super::ImportJobStatus, pub total_rows: i32, pub processed_rows: i32, pub created_rows: i32, pub skipped_rows: i32, pub error_log: Option, pub created_at: DateTime, pub completed_at: Option>, } /// An item's S3 keys (and DB-known file sizes) for content export. #[derive(Debug, Clone, FromRow)] pub struct ItemS3KeyRow { pub title: String, pub project_id: super::super::ProjectId, pub project_slug: Slug, pub audio_s3_key: Option, pub cover_s3_key: Option, pub video_s3_key: Option, pub audio_file_size_bytes: Option, pub cover_file_size_bytes: Option, pub video_file_size_bytes: Option, } /// A version's S3 key (and DB-known file size) for content export. #[derive(Debug, Clone, FromRow)] pub struct VersionS3KeyRow { pub s3_key: Option, pub file_name: Option, pub version_number: String, pub item_title: String, pub project_id: super::super::ProjectId, pub project_slug: Slug, pub file_size_bytes: Option, }