mirror of
https://github.com/clowzed/sero
synced 2024-05-23 09:42:12 +02:00
53 lines
1.2 KiB
Rust
53 lines
1.2 KiB
Rust
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
|
#[sea_orm(table_name = "subdomain")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
pub owner_id: i32,
|
|
pub enabled: bool,
|
|
#[sea_orm(unique)]
|
|
pub name: String,
|
|
#[sea_orm(unique)]
|
|
pub archive_path: Option<String>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::cors::Entity")]
|
|
Cors,
|
|
#[sea_orm(has_many = "super::file::Entity")]
|
|
File,
|
|
#[sea_orm(
|
|
belongs_to = "super::user::Entity",
|
|
from = "Column::OwnerId",
|
|
to = "super::user::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "NoAction"
|
|
)]
|
|
User,
|
|
}
|
|
|
|
impl Related<super::cors::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Cors.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::file::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::File.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::user::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::User.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|