use sea_orm::entity::prelude::*; | |
use serde::{Deserialize, Serialize}; | |
pub struct Model { | |
pub id: i64, | |
pub dialog_id: i64, | |
pub kb_id: i64, | |
} | |
pub enum Relation { | |
DialogInfo, | |
KbInfo, | |
} | |
impl RelationTrait for Relation { | |
fn def(&self) -> RelationDef { | |
match self { | |
Self::DialogInfo => Entity::belongs_to(super::dialog_info::Entity) | |
.from(Column::DialogId) | |
.to(super::dialog_info::Column::DialogId) | |
.into(), | |
Self::KbInfo => Entity::belongs_to(super::kb_info::Entity) | |
.from(Column::KbId) | |
.to(super::kb_info::Column::KbId) | |
.into(), | |
} | |
} | |
} | |
impl ActiveModelBehavior for ActiveModel {} |