audiobook_server 1.0.2

A self-hosted audiobook server
Documentation
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2

use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "progress")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    pub account_id: i32,
    pub music_id: i32,
    pub chapter_no: i32,
    #[sea_orm(column_type = "Double")]
    pub progress: f64,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::account::Entity",
        from = "Column::AccountId",
        to = "super::account::Column::Id",
        on_update = "Restrict",
        on_delete = "Restrict"
    )]
    Account,
    #[sea_orm(
        belongs_to = "super::music::Entity",
        from = "Column::MusicId",
        to = "super::music::Column::Id",
        on_update = "Restrict",
        on_delete = "Restrict"
    )]
    Music,
}

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

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

impl ActiveModelBehavior for ActiveModel {}