//! Report, collection, and session models for admin features. use chrono::{DateTime, Utc}; use sqlx::FromRow; use uuid::Uuid; use super::super::id_types::*; use super::super::validated_types::*; // ── Report models ── /// A user-submitted report against a project or item. #[derive(Debug, Clone, FromRow)] pub struct DbReport { pub id: ReportId, pub reporter_user_id: UserId, pub target_type: super::super::ReportTargetType, pub target_id: Uuid, pub report_type: super::super::ReportType, pub reason: String, pub status: super::super::ReportStatus, pub admin_notes: Option, pub resolved_by: Option, pub created_at: DateTime, pub resolved_at: Option>, } /// A report row joined with reporter, target, and owner info for admin display. #[derive(Debug, Clone, FromRow)] #[allow(dead_code)] // Fields populated by sqlx query, read during type conversion pub struct DbAdminReportRow { pub id: ReportId, pub reporter_username: String, pub target_type: super::super::ReportTargetType, pub target_title: String, pub target_slug_or_id: String, pub target_owner: String, pub report_type: super::super::ReportType, pub reason: String, pub status: super::super::ReportStatus, pub admin_notes: Option, pub created_at: DateTime, pub resolved_at: Option>, } /// Aggregate counts of reports by status. #[derive(Debug, Clone, FromRow)] pub struct DbReportStats { pub open: i64, pub resolved: i64, pub dismissed: i64, } // ── Collection models ── /// A user-curated collection of items (playlist, reading list, bundle). #[derive(Debug, Clone, FromRow)] pub struct DbCollection { pub id: CollectionId, pub user_id: UserId, pub slug: Slug, pub title: String, pub description: Option, pub is_public: bool, pub created_at: DateTime, pub updated_at: DateTime, } /// A collection with its item count, for listing views. #[derive(Debug, Clone, FromRow)] #[allow(dead_code)] // Fields populated by sqlx query, read during type conversion pub struct DbCollectionWithCount { pub id: CollectionId, pub user_id: UserId, pub slug: Slug, pub title: String, pub description: Option, pub is_public: bool, pub created_at: DateTime, pub updated_at: DateTime, pub item_count: i64, } /// An item in a collection, joined with item/project/user data for display. #[derive(Debug, Clone, FromRow)] #[allow(dead_code)] // Fields populated by sqlx query, read during type conversion pub struct DbCollectionItemRow { pub item_id: ItemId, pub title: String, pub description: Option, pub price_cents: i32, pub item_type: super::super::ItemType, pub username: Username, pub project_title: String, pub position: i32, pub added_at: DateTime, } /// A tracked login session for remote revocation. #[derive(Debug, Clone, FromRow)] pub struct DbUserSession { pub id: UserSessionId, pub user_id: UserId, pub created_at: DateTime, pub last_active_at: DateTime, pub user_agent: Option, pub ip_address: Option, }