use serde::{Deserialize, Serialize}; use uuid::Uuid; pub mod handlers; pub mod templates; #[derive( Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, sqlx::Type, )] #[repr(i32)] pub enum ShowKind { Movie = 0, Series = 1, LimitedSeries = 2, Short = 3, Unknown = 4, } impl Default for ShowKind { fn default() -> Self { Self::Unknown } } impl From for ShowKind { fn from(value: i32) -> Self { match value { 0 => Self::Movie, 1 => Self::Series, 2 => Self::LimitedSeries, 3 => Self::Short, 4 => Self::Unknown, _ => Self::Unknown, } } } #[derive( Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, sqlx::FromRow, )] pub struct Watch { pub id: Uuid, pub kind: ShowKind, pub title: String, pub metadata_url: Option, pub length: Option, pub release_date: Option, added_by: Uuid, // this shouldn't be exposed to randos created_at: i64, last_updated: i64, } impl Watch { pub fn new(title: &str, added_by: Uuid) -> Self { let id = Uuid::new_v4(); Self { id, title: title.to_string(), added_by, ..Default::default() } } }