app/src/entity/application_category.rs

37 lines
917 B
Rust
Raw Permalink Normal View History

2022-02-03 21:55:10 +00:00
//! 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")]
2022-02-03 21:55:10 +00:00
pub struct Model {
#[sea_orm(primary_key)]
#[serde(skip_deserializing)]
2022-02-03 21:55:10 +00:00
pub id: i32,
pub category_name: String,
pub active: bool,
pub glyph: Option<String>,
2022-02-03 21:55:10 +00:00
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Application,
}
2022-02-03 21:55:10 +00:00
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Application => Entity::has_many(super::application::Entity).into(),
}
2022-02-03 21:55:10 +00:00
}
}
impl Related<super::application::Entity> for Entity {
fn to() -> RelationDef {
Relation::Application.def()
}
}
2022-02-03 21:55:10 +00:00
impl ActiveModelBehavior for ActiveModel {}