2024-03-24 04:03:44 +01:00
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
|
|
|
#[sea_orm(table_name = "addressing")]
|
|
|
|
pub struct Model {
|
|
|
|
#[sea_orm(primary_key)]
|
2024-03-24 05:55:50 +01:00
|
|
|
pub id: i64,
|
2024-03-24 04:03:44 +01:00
|
|
|
pub actor: String,
|
|
|
|
pub activity: String,
|
|
|
|
pub object: Option<String>,
|
2024-03-24 04:58:49 +01:00
|
|
|
pub published: ChronoDateTimeUtc,
|
2024-03-24 04:03:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
|
|
pub enum Relation {
|
|
|
|
#[sea_orm(
|
|
|
|
belongs_to = "super::user::Entity",
|
|
|
|
from = "Column::Actor",
|
|
|
|
to = "super::user::Column::Id"
|
|
|
|
)]
|
|
|
|
User,
|
|
|
|
|
|
|
|
#[sea_orm(
|
|
|
|
belongs_to = "super::activity::Entity",
|
|
|
|
from = "Column::Activity",
|
|
|
|
to = "super::activity::Column::Id"
|
|
|
|
)]
|
|
|
|
Activity,
|
|
|
|
|
|
|
|
#[sea_orm(
|
|
|
|
belongs_to = "super::object::Entity",
|
|
|
|
from = "Column::Object",
|
|
|
|
to = "super::object::Column::Id"
|
|
|
|
)]
|
|
|
|
Object,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Related<super::user::Entity> for Entity {
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
Relation::User.def()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Related<super::activity::Entity> for Entity {
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
Relation::Activity.def()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Related<super::object::Entity> for Entity {
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
Relation::Object.def()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|