impl tags api (#2)

This commit is contained in:
Kould
2023-12-13 16:44:52 +08:00
committed by GitHub
parent c6d0d85ab5
commit f102c608bb
22 changed files with 319 additions and 79 deletions

View File

@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub did: i64,
#[sea_orm(primary_key, auto_increment = false)]
#[sea_orm(index)]
pub uid: i64,
pub doc_name: String,
pub size: i64,
@@ -14,8 +14,8 @@ pub struct Model {
pub r#type: String,
pub kb_progress: f64,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub created_at: Date,
pub updated_at: Date,
#[sea_orm(soft_delete_column)]
pub is_deleted: bool,
}
@@ -25,31 +25,31 @@ pub enum Relation {}
impl Related<super::tag_info::Entity> for Entity {
fn to() -> RelationDef {
super::tag_2_doc::Relation::Tag.def()
super::tag2_doc::Relation::Tag.def()
}
fn via() -> Option<RelationDef> {
Some(super::tag_2_doc::Relation::DocInfo.def().rev())
Some(super::tag2_doc::Relation::DocInfo.def().rev())
}
}
impl Related<super::kb_info::Entity> for Entity {
fn to() -> RelationDef {
super::kb_2_doc::Relation::KbInfo.def()
super::kb2_doc::Relation::KbInfo.def()
}
fn via() -> Option<RelationDef> {
Some(super::kb_2_doc::Relation::DocInfo.def().rev())
Some(super::kb2_doc::Relation::DocInfo.def().rev())
}
}
impl Related<Entity> for Entity {
fn to() -> RelationDef {
super::doc_2_doc::Relation::Parent.def()
super::doc2_doc::Relation::Parent.def()
}
fn via() -> Option<RelationDef> {
Some(super::doc_2_doc::Relation::Child.def().rev())
Some(super::doc2_doc::Relation::Child.def().rev())
}
}