Create album model
This commit is contained in:
parent
577090aa1a
commit
8638265fa3
@ -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>,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user