🚧 Add relations between store::Room and store::Area
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user