ShowModel: Remove dead unused methods.

This commit is contained in:
Jordan Petridis 2018-07-30 23:23:58 +03:00
parent cc0caff8d0
commit 132c9bbdff
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -1,8 +1,4 @@
use diesel::SaveChangesDsl; use models::Source;
use database::connection;
use errors::DataError;
use models::{Save, Source};
use schema::shows; use schema::shows;
#[derive(Queryable, Identifiable, AsChangeset, Associations, PartialEq)] #[derive(Queryable, Identifiable, AsChangeset, Associations, PartialEq)]
@ -20,19 +16,6 @@ pub struct Show {
source_id: i32, source_id: i32,
} }
impl Save<Show> for Show {
type Error = DataError;
/// Helper method to easily save/"sync" current state of self to the
/// Database.
fn save(&self) -> Result<Show, Self::Error> {
let db = connection();
let tempdb = db.get()?;
self.save_changes::<Show>(&*tempdb).map_err(From::from)
}
}
impl Show { impl Show {
/// Get the Feed `id`. /// Get the Feed `id`.
pub fn id(&self) -> i32 { pub fn id(&self) -> i32 {
@ -51,21 +34,11 @@ impl Show {
&self.link &self.link
} }
/// Set the Show/Feed `link`.
pub fn set_link(&mut self, value: &str) {
self.link = value.to_string();
}
/// Get the `description`. /// Get the `description`.
pub fn description(&self) -> &str { pub fn description(&self) -> &str {
&self.description &self.description
} }
/// Set the `description`.
pub fn set_description(&mut self, value: &str) {
self.description = value.to_string();
}
/// Get the `image_uri`. /// Get the `image_uri`.
/// ///
/// Represents the uri(url usually) that the Feed cover image is located at. /// Represents the uri(url usually) that the Feed cover image is located at.
@ -73,11 +46,6 @@ impl Show {
self.image_uri.as_ref().map(|s| s.as_str()) self.image_uri.as_ref().map(|s| s.as_str())
} }
/// Set the `image_uri`.
pub fn set_image_uri(&mut self, value: Option<&str>) {
self.image_uri = value.map(|x| x.to_string());
}
/// `Source` table foreign key. /// `Source` table foreign key.
pub fn source_id(&self) -> i32 { pub fn source_id(&self) -> i32 {
self.source_id self.source_id