Update to more generic db models
Some checks failed
Build Crate / build (push) Has been cancelled

Also integrated entities into codebase
This commit is contained in:
2024-08-18 03:26:12 -04:00
parent 5d28013f30
commit 528682d9b1
24 changed files with 314 additions and 419 deletions

View File

@@ -1,8 +1,5 @@
// Not a page, global state that is shared between all pages
use crate::data::pool_match::PoolMatchList;
use crate::data::pool_match::UserList;
use perseus::{prelude::*, state::GlobalStateCreator};
use serde::{Deserialize, Serialize};
@@ -10,16 +7,12 @@ cfg_if::cfg_if! {
if #[cfg(engine)] {
use std::thread;
use std::ops::Deref;
use crate::data::store::DATA;
}
}
#[derive(Serialize, Deserialize, ReactiveState, Clone)]
#[rx(alias = "AppStateRx")]
pub struct AppState {
pub matches: PoolMatchList,
pub users: UserList,
}
pub struct AppState {}
pub fn get_global_state_creator() -> GlobalStateCreator {
GlobalStateCreator::new()
@@ -29,15 +22,7 @@ pub fn get_global_state_creator() -> GlobalStateCreator {
#[engine_only_fn]
fn get_state() -> AppState {
let matches = thread::spawn(move || DATA.lock().unwrap().deref().matches.clone())
.join()
.unwrap();
let users = thread::spawn(move || DATA.lock().unwrap().deref().users.clone())
.join()
.unwrap();
AppState { matches, users }
AppState {}
}
#[engine_only_fn]