feat: like and share relations with object
This commit is contained in:
parent
97ed5d60b1
commit
f0cdd4bd7a
3 changed files with 46 additions and 2 deletions
|
@ -11,6 +11,19 @@ pub struct Model {
|
|||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::object::Entity",
|
||||
from = "Column::Likes",
|
||||
to = "super::object::Column::Id",
|
||||
)]
|
||||
Object
|
||||
}
|
||||
|
||||
impl Related<super::object::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Object.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
|
|
@ -116,6 +116,12 @@ pub enum Relation {
|
|||
|
||||
#[sea_orm(has_many = "super::attachment::Entity")]
|
||||
Attachment,
|
||||
|
||||
#[sea_orm(has_many = "super::like::Entity")]
|
||||
Like,
|
||||
|
||||
#[sea_orm(has_many = "super::share::Entity")]
|
||||
Share,
|
||||
}
|
||||
|
||||
impl Related<super::activity::Entity> for Entity {
|
||||
|
@ -142,4 +148,16 @@ impl Related<super::attachment::Entity> for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
impl Related<super::like::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Like.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::share::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Share.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
|
|
@ -11,6 +11,19 @@ pub struct Model {
|
|||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::object::Entity",
|
||||
from = "Column::Shares",
|
||||
to = "super::object::Column::Id",
|
||||
)]
|
||||
Object
|
||||
}
|
||||
|
||||
impl Related<super::object::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Object.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
|
Loading…
Reference in a new issue