38 lines
980 B
Rust
38 lines
980 B
Rust
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "library")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
pub path: String,
|
|
pub filename: String,
|
|
pub source_id: i32,
|
|
pub hash: u32,
|
|
pub artist: Option<String>,
|
|
pub album_artist: Option<String>,
|
|
pub name: Option<String>,
|
|
pub album: Option<String>,
|
|
pub duration: u32,
|
|
pub genres: Option<String>,
|
|
pub track: Option<i32>,
|
|
pub year: Option<i32>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::playlist_entries::Entity")]
|
|
PlaylistEntries,
|
|
}
|
|
|
|
impl Related<super::playlist_entries::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::PlaylistEntries.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|