Model refinement

This commit is contained in:
2025-10-01 19:34:07 -06:00
parent 06110b91a1
commit 6eec67a0fd
28 changed files with 292 additions and 143 deletions
+31 -1
View File
@@ -27,7 +27,7 @@ pub struct Model {
/// The season's directory
pub directory: PathBytes,
/// The season's poster path
pub relative_poster_path: Option<PathBytes>,
pub relative_poster_path: Option<String>,
}
impl ActiveModelBehavior for ActiveModel {}
@@ -44,6 +44,24 @@ pub enum Relation {
on_delete = "Cascade"
)]
Library,
/// The media info for this show
#[sea_orm(
belongs_to = "super::super::info::seasons::Entity",
from = "(Column::Show, Column::Season)",
to = "(super::super::info::seasons::Column::Show, super::super::info::seasons::Column::Season)",
on_update = "Cascade",
on_delete = "Cascade"
)]
MediaInfo,
/// The watched info for this show
#[sea_orm(
belongs_to = "super::super::watched::seasons::Entity",
from = "(Column::Show, Column::Season)",
to = "(super::super::watched::seasons::Column::Show, super::super::watched::seasons::Column::Season)",
on_update = "Cascade",
on_delete = "Cascade"
)]
WatchInfo,
}
impl Related<super::libraries::Entity> for Entity {
@@ -51,3 +69,15 @@ impl Related<super::libraries::Entity> for Entity {
Relation::Library.def()
}
}
impl Related<super::super::info::seasons::Entity> for Entity {
fn to() -> RelationDef {
Relation::MediaInfo.def()
}
}
impl Related<super::super::watched::seasons::Entity> for Entity {
fn to() -> RelationDef {
Relation::WatchInfo.def()
}
}