migrar Alpha a Tauri app con Turso/libsql como BD local
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
mod db;
|
||||
|
||||
use db::commands;
|
||||
use std::sync::Mutex;
|
||||
|
||||
fn main() {
|
||||
let db_path = {
|
||||
let path = dirs_next::config_dir()
|
||||
.unwrap_or_else(|| std::path::PathBuf::from("."))
|
||||
.join("com.teloprax.alpha")
|
||||
.join("alpha.db");
|
||||
|
||||
std::fs::create_dir_all(path.parent().unwrap()).ok();
|
||||
path.to_str().unwrap().to_string()
|
||||
};
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.manage(Mutex::new(db_path))
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::get_projects,
|
||||
commands::save_project,
|
||||
commands::delete_project,
|
||||
commands::get_work_items,
|
||||
commands::save_work_item,
|
||||
commands::delete_work_item,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
Reference in New Issue
Block a user