trifid_api_entities 0.2.0

Database entities for trifid-api
Documentation
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2

use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "firewall_rule")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub id: String,
    pub role: String,
    pub protocol: String,
    pub description: String,
    pub allowed_role_id: Option<String>,
    pub port_range_from: i32,
    pub port_range_to: i32,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::role::Entity",
        from = "Column::AllowedRoleId",
        to = "super::role::Column::Id",
        on_update = "NoAction",
        on_delete = "Cascade"
    )]
    Role2,
    #[sea_orm(
        belongs_to = "super::role::Entity",
        from = "Column::Role",
        to = "super::role::Column::Id",
        on_update = "Cascade",
        on_delete = "Cascade"
    )]
    Role1,
}

impl ActiveModelBehavior for ActiveModel {}