Implement contacts using sea-orm

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-11-30 17:36:25 +01:00
parent 04d553d4d3
commit d1a44b889e
5 changed files with 531 additions and 159 deletions

View file

@ -20,6 +20,8 @@ pub struct Model {
pub enum Relation {
#[sea_orm(has_many = "super::access_token::Entity")]
AccessToken,
#[sea_orm(has_one = "super::room_participant::Entity")]
RoomParticipant,
}
impl Related<super::access_token::Entity> for Entity {
@ -28,4 +30,10 @@ impl Related<super::access_token::Entity> for Entity {
}
}
impl Related<super::room_participant::Entity> for Entity {
fn to() -> RelationDef {
Relation::RoomParticipant.def()
}
}
impl ActiveModelBehavior for ActiveModel {}