All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
52 lines
1.3 KiB
Rust
52 lines
1.3 KiB
Rust
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.4
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "artist")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i64,
|
|
pub name: String,
|
|
pub cover_art_id: Option<i64>,
|
|
pub artist_image_url: Option<String>,
|
|
pub album_count: i32,
|
|
pub starred: Option<TimeDateTimeWithTimeZone>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::album::Entity")]
|
|
Album,
|
|
#[sea_orm(
|
|
belongs_to = "super::cover_art::Entity",
|
|
from = "Column::CoverArtId",
|
|
to = "super::cover_art::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "SetNull"
|
|
)]
|
|
CoverArt,
|
|
#[sea_orm(has_many = "super::track::Entity")]
|
|
Track,
|
|
}
|
|
|
|
impl Related<super::album::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Album.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::cover_art::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::CoverArt.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::track::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Track.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|