diff --git a/src/models.rs b/src/models.rs index 74c4ae7..d71fc6c 100644 --- a/src/models.rs +++ b/src/models.rs @@ -71,3 +71,26 @@ pub struct Album { pub release_date: Option, } +/// Model for a song +#[cfg_attr(feature = "ssr", derive(Queryable, Selectable, Insertable))] +#[cfg_attr(feature = "ssr", diesel(table_name = crate::schema::songs))] +#[cfg_attr(feature = "ssr", diesel(check_for_backend(diesel::pg::Pg)))] +pub struct Song { + /// A unique id for the song + #[cfg_attr(feature = "ssr", diesel(deserialize_as = i32))] + pub id: Option, + /// The song's title + pub title: String, + /// The album the song is from + pub album_id: Option, + /// The track number of the song on the album + pub track: Option, + /// The duration of the song in seconds + pub duration: i32, + /// The song's release date + pub release_date: Option, + /// The path to the song's audio file + pub storage_path: String, + /// The path to the song's image file + pub image_path: Option, +}