2024-05-24 05:05:14 +02:00
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
|
|
|
#[sea_orm(table_name = "instances")]
|
|
|
|
pub struct Model {
|
|
|
|
#[sea_orm(primary_key)]
|
2024-05-25 04:37:17 +02:00
|
|
|
pub internal: i64,
|
|
|
|
#[sea_orm(unique)]
|
2024-05-24 05:05:14 +02:00
|
|
|
pub domain: String,
|
2024-05-25 04:37:17 +02:00
|
|
|
pub name: Option<String>,
|
2024-05-24 05:05:14 +02:00
|
|
|
pub software: Option<String>,
|
|
|
|
pub version: Option<String>,
|
2024-05-25 04:37:17 +02:00
|
|
|
pub icon: Option<String>,
|
2024-05-24 05:05:14 +02:00
|
|
|
pub down_since: Option<ChronoDateTimeUtc>,
|
|
|
|
pub users: Option<i32>,
|
|
|
|
pub posts: Option<i32>,
|
|
|
|
pub published: ChronoDateTimeUtc,
|
|
|
|
pub updated: ChronoDateTimeUtc,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
|
|
pub enum Relation {
|
|
|
|
#[sea_orm(has_many = "super::actor::Entity")]
|
|
|
|
Actors,
|
|
|
|
#[sea_orm(has_many = "super::addressing::Entity")]
|
|
|
|
Addressing,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Related<super::actor::Entity> for Entity {
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
Relation::Actors.def()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Related<super::addressing::Entity> for Entity {
|
|
|
|
fn to() -> RelationDef {
|
|
|
|
Relation::Addressing.def()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|