Create album model

This commit is contained in:
Ethan Girouard 2024-02-08 18:41:28 -05:00
parent 577090aa1a
commit 8638265fa3
Signed by: eta357
GPG Key ID: 7BCDC36DFD11C146

View File

@ -1,4 +1,5 @@
use std::time::SystemTime;
use time::Date;
use serde::{Deserialize, Serialize};
#[cfg(feature = "ssr")]
@ -56,3 +57,17 @@ pub struct Artist {
pub name: String,
}
/// Model for an album
#[cfg_attr(feature = "ssr", derive(Queryable, Selectable, Insertable))]
#[cfg_attr(feature = "ssr", diesel(table_name = crate::schema::albums))]
#[cfg_attr(feature = "ssr", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct Album {
/// A unique id for the album
#[cfg_attr(feature = "ssr", diesel(deserialize_as = i32))]
pub id: Option<i32>,
/// The album's title
pub title: String,
/// The album's release date
pub release_date: Option<Date>,
}