mocra 0.3.0

A distributed, event-driven crawling and data collection framework
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.11

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

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(schema_name = "base", table_name = "platform")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    #[sea_orm(unique)]
    pub name: String,
    #[sea_orm(column_type = "Text", nullable)]
    pub description: Option<String>,
    pub base_url: Option<String>,
    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_account_platform::Entity")]
    RelAccountPlatform,
    #[sea_orm(has_many = "super::rel_module_platform::Entity")]
    RelModulePlatform,
}

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

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

impl Related<super::account::Entity> for Entity {
    fn to() -> RelationDef {
        super::rel_account_platform::Relation::Account.def()
    }
    fn via() -> Option<RelationDef> {
        Some(super::rel_account_platform::Relation::Platform.def().rev())
    }
}

impl Related<super::module::Entity> for Entity {
    fn to() -> RelationDef {
        super::rel_module_platform::Relation::Module.def()
    }
    fn via() -> Option<RelationDef> {
        Some(super::rel_module_platform::Relation::Platform.def().rev())
    }
}

impl ActiveModelBehavior for ActiveModel {}