use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(schema_name = "base", table_name = "download_middleware")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
#[sea_orm(unique)]
pub name: String,
pub weight: 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(has_many = "super::rel_module_download_middleware::Entity")]
RelModuleDownloadMiddleware,
}
impl Related<super::rel_module_download_middleware::Entity> for Entity {
fn to() -> RelationDef {
Relation::RelModuleDownloadMiddleware.def()
}
}
impl Related<super::module::Entity> for Entity {
fn to() -> RelationDef {
super::rel_module_download_middleware::Relation::Module.def()
}
fn via() -> Option<RelationDef> {
Some(
super::rel_module_download_middleware::Relation::DownloadMiddleware
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}