61 lines
1.4 KiB
Rust
61 lines
1.4 KiB
Rust
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<i64>,
|
|
pub importer_guild_id: Option<i64>,
|
|
pub imported_date: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Queryable)]
|
|
pub struct Language {
|
|
pub id: i32,
|
|
pub alpha3_b: String,
|
|
pub alpha3_t: Option<String>,
|
|
pub alpha2_b: Option<String>,
|
|
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<i32>,
|
|
pub film_type: String,
|
|
pub season: Option<i32>,
|
|
pub episode: Option<i32>,
|
|
pub poster_link: Option<String>,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize)]
|
|
pub struct SubtitleTrimmed {
|
|
pub id: i32,
|
|
pub film_id: i32,
|
|
pub language_id: i32,
|
|
pub imported_date: DateTime<Utc>,
|
|
}
|
|
|
|
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<SubtitleTrimmed>,
|
|
pub films: Vec<Film>,
|
|
pub languages: Vec<Language>,
|
|
}
|