flix_db/entity/info/
shows.rs1use flix_model::id::ShowId;
4
5use chrono::NaiveDate;
6use sea_orm::{
7 ActiveModelBehavior, DeriveEntityModel, DerivePrimaryKey, DeriveRelation, EntityTrait,
8 EnumIter, PrimaryKeyTrait, Related, RelationDef, RelationTrait,
9};
10
11#[derive(Debug, Clone, DeriveEntityModel)]
13#[sea_orm(table_name = "flix_info_shows")]
14pub struct Model {
15 #[sea_orm(primary_key, auto_increment = false)]
17 pub id: ShowId,
18 pub title: String,
20 pub tagline: String,
22 pub overview: String,
24 pub date: NaiveDate,
26}
27
28impl ActiveModelBehavior for ActiveModel {}
29
30#[derive(Debug, EnumIter, DeriveRelation)]
32pub enum Relation {
33 #[sea_orm(has_many = "super::seasons::Entity")]
35 Seasons,
36 #[sea_orm(has_many = "super::episodes::Entity")]
38 Episodes,
39}
40
41impl Related<super::seasons::Entity> for Entity {
42 fn to() -> RelationDef {
43 Relation::Seasons.def()
44 }
45}
46
47impl Related<super::episodes::Entity> for Entity {
48 fn to() -> RelationDef {
49 Relation::Episodes.def()
50 }
51}