1
0
Fork 0
forked from alemi/upub
upub/src/model/user.rs

27 lines
569 B
Rust
Raw Normal View History

use sea_orm::entity::prelude::*;
#[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,
pub name: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}
impl crate::activitystream::Object for Model {
fn id(&self) -> Option<&str> {
Some(&self.id)
}
fn name (&self) -> Option<&str> {
self.name.as_deref()
}
}