use schema::{episode, podcast}; #[derive(Queryable, Identifiable)] #[derive(Associations)] #[table_name = "episode"] #[belongs_to(Podcast, foreign_key = "podcast_id")] #[derive(Debug, Clone)] pub struct Episode { id: i32, title: String, uri: String, local_uri: Option, description: Option, thumbnail: Option, lenght: Option, guid: Option, podcast_id: i32, } #[derive(Queryable, Identifiable)] #[table_name = "podcast"] #[derive(Debug, Clone)] pub struct Podcast { id: i32, title: String, uri: String, link: Option, description: Option, last_modified: Option, http_etag: Option, image_uri: Option, image_local: Option, } #[derive(Insertable)] #[table_name = "episode"] #[derive(Debug, Clone)] pub struct NewEpisode<'a> { title: &'a str, uri: &'a str, local_uri: Option<&'a str>, description: Option<&'a str>, thumbnail: Option<&'a str>, lenght: Option, guid: Option<&'a str>, podcast_id: i32, } #[derive(Insertable)] #[table_name = "podcast"] #[derive(Debug, Clone)] pub struct NewPodcast<'a> { title: &'a str, uri: &'a str, link: Option<&'a str>, description: Option<&'a str>, last_modified: Option<&'a str>, http_etag: Option<&'a str>, image_uri: Option<&'a str>, image_local: Option<&'a str>, }