use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(schema_name = "base", table_name = "rel_module_download_middleware")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub module_id: i32,
#[sea_orm(primary_key, auto_increment = false)]
pub download_middleware_id: i32,
pub priority: i32,
pub enabled: bool,
#[sea_orm(column_type = "JsonBinary")]
pub config: Json,
pub created_at: DateTime,
pub updated_at: DateTime,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::download_middleware::Entity",
from = "Column::DownloadMiddlewareId",
to = "super::download_middleware::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
DownloadMiddleware,
#[sea_orm(
belongs_to = "super::module::Entity",
from = "Column::ModuleId",
to = "super::module::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Module,
}
impl Related<super::download_middleware::Entity> for Entity {
fn to() -> RelationDef {
Relation::DownloadMiddleware.def()
}
}
impl Related<super::module::Entity> for Entity {
fn to() -> RelationDef {
Relation::Module.def()
}
}
impl ActiveModelBehavior for ActiveModel {}