2024-03-16 03:27:36 +01:00
|
|
|
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
|
|
2024-03-16 05:45:58 +01:00
|
|
|
use crate::activitystream::{self, types::ActorType};
|
|
|
|
|
2024-03-16 03:27:36 +01:00
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
|
|
|
#[sea_orm(table_name = "users")]
|
|
|
|
pub struct Model {
|
|
|
|
#[sea_orm(primary_key)]
|
|
|
|
/// must be user@instance.org, even if local! TODO bad design...
|
|
|
|
pub id: String,
|
2024-03-16 05:45:58 +01:00
|
|
|
|
|
|
|
pub actor_type: ActorType,
|
|
|
|
|
|
|
|
pub name: String,
|
2024-03-16 03:27:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
|
|
pub enum Relation {}
|
|
|
|
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|
|
|
|
|
2024-03-16 05:45:58 +01:00
|
|
|
impl activitystream::Object for Model {
|
2024-03-16 03:27:36 +01:00
|
|
|
fn id(&self) -> Option<&str> {
|
|
|
|
Some(&self.id)
|
|
|
|
}
|
|
|
|
|
2024-03-16 05:45:58 +01:00
|
|
|
fn full_type(&self) -> Option<activitystream::Type> {
|
|
|
|
Some(activitystream::Type::ActorType(self.actor_type))
|
|
|
|
}
|
|
|
|
|
2024-03-16 03:27:36 +01:00
|
|
|
fn name (&self) -> Option<&str> {
|
2024-03-16 05:45:58 +01:00
|
|
|
Some(&self.name)
|
2024-03-16 03:27:36 +01:00
|
|
|
}
|
|
|
|
}
|