librmo 0.4.4

A library to manage media files and play them
Documentation
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15

use sea_orm::entity::prelude::*;
use serde::Serialize;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize)]
#[sea_orm(table_name = "media")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    pub mtime: String,
    #[sea_orm(unique)]
    pub path: String,
    pub file_type: String,
    pub library_id: i32,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::library::Entity",
        from = "Column::LibraryId",
        to = "super::library::Column::Id",
        on_update = "NoAction",
        on_delete = "Cascade"
    )]
    Library,
    #[sea_orm(has_many = "super::music::Entity")]
    Music,
    #[sea_orm(has_many = "super::report::Entity")]
    Report,
}

impl Related<super::report::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::Report.def()
    }
}

impl Related<super::library::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::Library.def()
    }
}

impl Related<super::music::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::Music.def()
    }
}

impl ActiveModelBehavior for ActiveModel {}