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 = "rel_module_platform")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub module_id: i32,
    #[sea_orm(primary_key, auto_increment = false)]
    pub platform_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::module::Entity",
        from = "Column::ModuleId",
        to = "super::module::Column::Id",
        on_update = "NoAction",
        on_delete = "Cascade"
    )]
    Module,
    #[sea_orm(
        belongs_to = "super::platform::Entity",
        from = "Column::PlatformId",
        to = "super::platform::Column::Id",
        on_update = "NoAction",
        on_delete = "Cascade"
    )]
    Platform,
}

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

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

impl ActiveModelBehavior for ActiveModel {}