use serde::{Deserialize, Serialize}; use chrono::{DateTime, Utc}; #[derive(Deserialize, Serialize, Queryable)] pub struct Subtitle { pub id: i32, pub film_id: i32, pub language_id: i32, pub importer_id: Option, pub importer_guild_id: Option, pub imported_date: DateTime, } #[derive(Deserialize, Serialize, Queryable)] pub struct Language { pub id: i32, pub alpha3_b: String, pub alpha3_t: Option, pub alpha2_b: Option, pub english: String, pub french: String, } #[derive(Deserialize, Serialize, Queryable)] pub struct Film { pub id: i32, pub imdb_id: String, pub title: String, pub year: Option, pub film_type: String, pub season: Option, pub episode: Option, pub poster_link: Option, } #[derive(Deserialize, Serialize)] pub struct SubtitleTrimmed { pub id: i32, pub film_id: i32, pub language_id: i32, pub imported_date: DateTime, } impl SubtitleTrimmed { pub fn from(s: Subtitle) -> SubtitleTrimmed { SubtitleTrimmed { id: s.id, film_id: s.film_id, language_id: s.language_id, imported_date: s.imported_date } } } #[derive(Deserialize, Serialize, Queryable)] pub struct SubtitleOutV1 { pub subtitles: Vec, pub films: Vec, pub languages: Vec, }