Added auth
This commit is contained in:
@@ -37,6 +37,8 @@ pub struct Model {
|
||||
pub album_id: Option<i32>,
|
||||
#[sea_orm(nullable)]
|
||||
pub track_id: Option<i32>,
|
||||
#[sea_orm(nullable)]
|
||||
pub user_id: Option<i32>,
|
||||
pub name: String,
|
||||
#[sea_orm(nullable)]
|
||||
pub musicbrainz_id: Option<String>,
|
||||
@@ -47,6 +49,13 @@ pub struct Model {
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::UserId",
|
||||
to = "super::user::Column::Id",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
User,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::artist::Entity",
|
||||
from = "Column::ArtistId",
|
||||
@@ -72,6 +81,12 @@ pub enum Relation {
|
||||
Downloads,
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::artist::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Artist.def()
|
||||
|
||||
Reference in New Issue
Block a user