🚧 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

@@ -1,9 +1,10 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::{cell::RefCell, collections::HashSet};
use dioxus::prelude::*;
use crate::domain::model::{
room::RoomId,
space::SpaceId,
store_interface::{SpaceStoreConsumerInterface, SpaceStoreProviderInterface},
};
@@ -13,6 +14,7 @@ use crate::domain::model::{
pub struct Store {
id: SpaceId,
name: Option<String>,
room_ids: HashSet<RoomId>,
}
#[derive(Clone)]
@@ -34,11 +36,10 @@ impl Space {
domain: space,
}
}
}
impl PartialEq for Space {
fn eq(&self, other: &Self) -> bool {
self.store.borrow().id == other.store.borrow().id
pub fn add_room(&self, room_id: RoomId) {
let mut store = self.store.borrow_mut();
store.room_ids.write().insert(room_id);
}
}