2023-11-28 02:02:28 +00:00
|
|
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
|
2023-10-09 19:24:32 +00:00
|
|
|
|
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
|
|
|
#[sea_orm(table_name = "track")]
|
|
|
|
|
pub struct Model {
|
|
|
|
|
#[sea_orm(primary_key)]
|
|
|
|
|
pub id: i64,
|
|
|
|
|
pub title: String,
|
|
|
|
|
pub album_id: Option<i64>,
|
|
|
|
|
pub artist_id: Option<i64>,
|
|
|
|
|
pub is_dir: bool,
|
|
|
|
|
pub cover_art_id: Option<i64>,
|
2023-10-10 18:25:02 +00:00
|
|
|
pub created: TimeDateTimeWithTimeZone,
|
2023-10-12 16:18:36 +00:00
|
|
|
pub starred: Option<TimeDateTimeWithTimeZone>,
|
2023-10-09 19:24:32 +00:00
|
|
|
pub duration: i64,
|
2023-10-10 18:25:02 +00:00
|
|
|
pub bit_rate: Option<i64>,
|
2023-10-12 16:18:36 +00:00
|
|
|
pub track_number: Option<i32>,
|
2023-10-09 19:24:32 +00:00
|
|
|
pub size: i64,
|
2023-10-12 16:18:36 +00:00
|
|
|
pub play_count: i64,
|
|
|
|
|
pub disc_number: i32,
|
2023-10-09 19:24:32 +00:00
|
|
|
pub suffix: String,
|
|
|
|
|
pub content_type: String,
|
|
|
|
|
pub is_video: bool,
|
|
|
|
|
pub path: String,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
|
|
|
pub enum Relation {
|
|
|
|
|
#[sea_orm(
|
|
|
|
|
belongs_to = "super::album::Entity",
|
|
|
|
|
from = "Column::AlbumId",
|
|
|
|
|
to = "super::album::Column::Id",
|
|
|
|
|
on_update = "Cascade",
|
|
|
|
|
on_delete = "Cascade"
|
|
|
|
|
)]
|
|
|
|
|
Album,
|
|
|
|
|
#[sea_orm(
|
|
|
|
|
belongs_to = "super::artist::Entity",
|
|
|
|
|
from = "Column::ArtistId",
|
|
|
|
|
to = "super::artist::Column::Id",
|
|
|
|
|
on_update = "Cascade",
|
|
|
|
|
on_delete = "Cascade"
|
|
|
|
|
)]
|
|
|
|
|
Artist,
|
|
|
|
|
#[sea_orm(
|
|
|
|
|
belongs_to = "super::cover_art::Entity",
|
|
|
|
|
from = "Column::CoverArtId",
|
|
|
|
|
to = "super::cover_art::Column::Id",
|
|
|
|
|
on_update = "Cascade",
|
|
|
|
|
on_delete = "Cascade"
|
|
|
|
|
)]
|
|
|
|
|
CoverArt,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Related<super::album::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
Relation::Album.def()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Related<super::artist::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
Relation::Artist.def()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Related<super::cover_art::Entity> for Entity {
|
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
|
Relation::CoverArt.def()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|