added redb and moved workspaces to use db. using tags instead of environment for workspace

This commit is contained in:
xyroscar
2025-11-26 16:38:11 -08:00
parent ce75694ffb
commit 0d23ffcaec
16 changed files with 1430 additions and 228 deletions

View File

@@ -1,14 +1,44 @@
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
// Resona - API Client Application
mod db;
mod workspaces;
use db::Database;
// Re-export workspace commands for generate_handler macro
use workspaces::{
add_workspace_to_sync_group, create_sync_group, create_workspace, delete_sync_group,
delete_workspace, get_sync_group, get_sync_group_for_workspace, get_sync_groups,
get_workspace, get_workspaces, get_workspaces_by_sync_group, remove_workspace_from_sync_group,
update_sync_group, update_workspace,
};
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
// Initializing the database
let db = Database::open().expect("Failed to initialize database");
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.invoke_handler(tauri::generate_handler![greet])
.manage(db)
.invoke_handler(tauri::generate_handler![
// Workspace commands
get_workspaces,
get_workspace,
create_workspace,
update_workspace,
delete_workspace,
// Sync group commands
get_sync_groups,
get_sync_group,
get_sync_group_for_workspace,
create_sync_group,
update_sync_group,
delete_sync_group,
get_workspaces_by_sync_group,
add_workspace_to_sync_group,
remove_workspace_from_sync_group,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}