Add model for history entry
This commit is contained in:
parent
0c64865cd9
commit
62def56a41
@ -292,3 +292,20 @@ impl Song {
|
|||||||
Ok(my_artists)
|
Ok(my_artists)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Model for a history entry
|
||||||
|
#[cfg_attr(feature = "ssr", derive(Queryable, Selectable, Insertable))]
|
||||||
|
#[cfg_attr(feature = "ssr", diesel(table_name = crate::schema::song_history))]
|
||||||
|
#[cfg_attr(feature = "ssr", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct HistoryEntry {
|
||||||
|
/// A unique id for the history entry
|
||||||
|
#[cfg_attr(feature = "ssr", diesel(deserialize_as = i32))]
|
||||||
|
pub id: Option<i32>,
|
||||||
|
/// The id of the user who listened to the song
|
||||||
|
pub user_id: i32,
|
||||||
|
/// The date the song was listened to
|
||||||
|
pub date: SystemTime,
|
||||||
|
/// The id of the song that was listened to
|
||||||
|
pub song_id: i32,
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user