File size: 1,268 Bytes
c6d0d85
6858ec5
 
c6d0d85
 
 
 
 
1eb186a
c6d0d85
f102c60
c6d0d85
249b27c
 
c6d0d85
95c6cbb
1eb186a
 
 
95c6cbb
1eb186a
c6d0d85
 
 
 
 
 
 
f102c60
c6d0d85
 
 
f102c60
c6d0d85
 
 
 
 
f102c60
c6d0d85
 
 
f102c60
c6d0d85
 
 
6858ec5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use sea_orm::entity::prelude::*;
use serde::{ Deserialize, Serialize };
use chrono::{ DateTime, FixedOffset };

#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)]
#[sea_orm(table_name = "kb_info")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    #[serde(skip_deserializing)]
    pub kb_id: i64,
    #[sea_orm(index)]
    pub uid: i64,
    pub kb_name: String,
    pub icon: i16,

    #[serde(skip_deserializing)]
    pub created_at: DateTime<FixedOffset>,
    #[serde(skip_deserializing)]
    pub updated_at: DateTime<FixedOffset>,
    #[serde(skip_deserializing)]
    pub is_deleted: bool,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl Related<super::doc_info::Entity> for Entity {
    fn to() -> RelationDef {
        super::kb2_doc::Relation::DocInfo.def()
    }

    fn via() -> Option<RelationDef> {
        Some(super::kb2_doc::Relation::KbInfo.def().rev())
    }
}

impl Related<super::dialog_info::Entity> for Entity {
    fn to() -> RelationDef {
        super::dialog2_kb::Relation::DialogInfo.def()
    }

    fn via() -> Option<RelationDef> {
        Some(super::dialog2_kb::Relation::KbInfo.def().rev())
    }
}

impl ActiveModelBehavior for ActiveModel {}