🚧 Add relations between store::Room and store::Area

This commit is contained in:
2024-05-16 22:31:48 +02:00
parent d77c2a9d12
commit cbe32c250e
5 changed files with 53 additions and 21 deletions

View File

@@ -208,6 +208,7 @@ impl RoomMessagingConsumerInterface for Room {
}
}
#[async_trait(?Send)]
impl RoomStoreConsumerInterface for Room {
fn id(&self) -> &RoomId {
&self.id
@@ -220,4 +221,8 @@ impl RoomStoreConsumerInterface for Room {
fn name(&self) -> Option<String> {
self.name.borrow().clone()
}
fn spaces(&self) -> &Vec<SpaceId> {
&self.spaces
}
}

View File

@@ -1,6 +1,9 @@
use std::rc::Rc;
use async_trait::async_trait;
use super::{
common::Avatar,
room::{Invitation, RoomId},
room_member::RoomMember,
space::SpaceId,
@@ -20,24 +23,25 @@ pub trait AccountStoreProviderInterface {
) -> Rc<dyn SpaceStoreProviderInterface>;
}
#[allow(dead_code)]
#[async_trait(?Send)]
pub trait RoomStoreConsumerInterface {
fn id(&self) -> &RoomId;
fn is_direct(&self) -> Option<bool>;
fn name(&self) -> Option<String>;
async fn avatar(&self) -> Option<Avatar>;
fn spaces(&self) -> &Vec<SpaceId>;
}
pub trait RoomStoreProviderInterface {
fn on_new_member(&self, member: RoomMember);
fn on_new_name(&self, name: Option<String>);
fn on_new_avatar(&self, avatar: Option<Avatar>);
fn on_new_member(&self, member: RoomMember);
fn on_invitation(&self, invitation: Invitation);
}
#[allow(dead_code)]
pub trait SpaceStoreConsumerInterface {
fn id(&self) -> &SpaceId;
fn name(&self) -> Option<String>;
}