app/src/entity/application_category.rs

37 lines
917 B
Rust

//! SeaORM Entity. Generated by sea-orm-codegen 0.5.0
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "application_category")]
#[serde(rename_all = "camelCase")]
pub struct Model {
#[sea_orm(primary_key)]
#[serde(skip_deserializing)]
pub id: i32,
pub category_name: String,
pub active: bool,
pub glyph: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Application,
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Application => Entity::has_many(super::application::Entity).into(),
}
}
}
impl Related<super::application::Entity> for Entity {
fn to() -> RelationDef {
Relation::Application.def()
}
}
impl ActiveModelBehavior for ActiveModel {}