impl tags api (#2)
This commit is contained in:
@@ -2,9 +2,10 @@ use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)]
|
||||
#[sea_orm(table_name = "dialog_2_kb")]
|
||||
#[sea_orm(table_name = "dialog2_kb")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
#[sea_orm(index)]
|
||||
pub dialog_id: i64,
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub kb_id: i64,
|
||||
@@ -6,15 +6,13 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub dialog_id: i64,
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
#[sea_orm(index)]
|
||||
pub uid: i64,
|
||||
pub dialog_name: String,
|
||||
pub history: String,
|
||||
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
#[sea_orm(soft_delete_column)]
|
||||
pub is_deleted: bool,
|
||||
pub created_at: Date,
|
||||
pub updated_at: Date,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
@@ -22,11 +20,11 @@ pub enum Relation {}
|
||||
|
||||
impl Related<super::kb_info::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
super::dialog_2_kb::Relation::KbInfo.def()
|
||||
super::dialog2_kb::Relation::KbInfo.def()
|
||||
}
|
||||
|
||||
fn via() -> Option<RelationDef> {
|
||||
Some(super::dialog_2_kb::Relation::DialogInfo.def().rev())
|
||||
Some(super::dialog2_kb::Relation::DialogInfo.def().rev())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)]
|
||||
#[sea_orm(table_name = "doc_2_doc")]
|
||||
#[sea_orm(table_name = "doc2_doc")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
#[sea_orm(index)]
|
||||
pub parent_id: i64,
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub did: i64,
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)]
|
||||
#[sea_orm(table_name = "kb_2_doc")]
|
||||
#[sea_orm(table_name = "kb2_doc")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
#[sea_orm(index)]
|
||||
pub kb_id: i64,
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub uid: i64,
|
||||
@@ -6,15 +6,13 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub kb_id: i64,
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
#[sea_orm(index)]
|
||||
pub uid: i64,
|
||||
pub kn_name: String,
|
||||
pub icon: i64,
|
||||
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
#[sea_orm(soft_delete_column)]
|
||||
pub is_deleted: bool,
|
||||
pub created_at: Date,
|
||||
pub updated_at: Date,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
@@ -22,21 +20,21 @@ pub enum Relation {}
|
||||
|
||||
impl Related<super::doc_info::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
super::kb_2_doc::Relation::DocInfo.def()
|
||||
super::kb2_doc::Relation::DocInfo.def()
|
||||
}
|
||||
|
||||
fn via() -> Option<RelationDef> {
|
||||
Some(super::kb_2_doc::Relation::KbInfo.def().rev())
|
||||
Some(super::kb2_doc::Relation::KbInfo.def().rev())
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::dialog_info::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
super::dialog_2_kb::Relation::DialogInfo.def()
|
||||
super::dialog2_kb::Relation::DialogInfo.def()
|
||||
}
|
||||
|
||||
fn via() -> Option<RelationDef> {
|
||||
Some(super::dialog_2_kb::Relation::KbInfo.def().rev())
|
||||
Some(super::dialog2_kb::Relation::KbInfo.def().rev())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
mod user_info;
|
||||
mod tag_info;
|
||||
mod tag_2_doc;
|
||||
mod kb_2_doc;
|
||||
mod dialog_2_kb;
|
||||
mod doc_2_doc;
|
||||
mod kb_info;
|
||||
mod doc_info;
|
||||
mod dialog_info;
|
||||
pub(crate) mod user_info;
|
||||
pub(crate) mod tag_info;
|
||||
mod tag2_doc;
|
||||
mod kb2_doc;
|
||||
mod dialog2_kb;
|
||||
mod doc2_doc;
|
||||
pub(crate) mod kb_info;
|
||||
pub(crate) mod doc_info;
|
||||
pub(crate) mod dialog_info;
|
||||
@@ -2,9 +2,10 @@ use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)]
|
||||
#[sea_orm(table_name = "tag_2_doc")]
|
||||
#[sea_orm(table_name = "tag2_doc")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
#[sea_orm(index)]
|
||||
pub tag_id: i64,
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub uid: i64,
|
||||
@@ -25,7 +26,7 @@ impl RelationTrait for Relation {
|
||||
.into(),
|
||||
Self::Tag => Entity::belongs_to(super::tag_info::Entity)
|
||||
.from(Column::TagId)
|
||||
.to(super::tag_info::Column::Uid)
|
||||
.to(super::tag_info::Column::Tid)
|
||||
.into(),
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
#[serde(skip_deserializing)]
|
||||
pub tid: i64,
|
||||
pub uid: i64,
|
||||
pub tag_name: String,
|
||||
pub regx: String,
|
||||
@@ -13,10 +14,8 @@ pub struct Model {
|
||||
pub icon: i64,
|
||||
pub dir: String,
|
||||
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
#[sea_orm(soft_delete_column)]
|
||||
pub is_deleted: bool,
|
||||
pub created_at: Date,
|
||||
pub updated_at: Date,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
@@ -24,11 +23,11 @@ pub enum Relation {}
|
||||
|
||||
impl Related<super::doc_info::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
super::tag_2_doc::Relation::DocInfo.def()
|
||||
super::tag2_doc::Relation::DocInfo.def()
|
||||
}
|
||||
|
||||
fn via() -> Option<RelationDef> {
|
||||
Some(super::tag_2_doc::Relation::Tag.def().rev())
|
||||
Some(super::tag2_doc::Relation::Tag.def().rev())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ pub struct Model {
|
||||
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
pub updated_at: DateTimeWithTimeZone,
|
||||
#[sea_orm(soft_delete_column)]
|
||||
pub is_deleted: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
||||
Reference in New Issue
Block a user