Added auth

This commit is contained in:
Connor Johnstone
2026-03-19 14:02:09 -04:00
parent c6452609d6
commit a9d414bffa
10 changed files with 271 additions and 24 deletions
+15
View File
@@ -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()