orchai/src-tauri/src/lib.rs
thibaud-leclere 738f6c5c55 feat: Tauri commands for project CRUD with git clone support
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 09:58:20 +02:00

36 lines
1 KiB
Rust

mod commands;
mod db;
mod error;
mod models;
use std::sync::Mutex;
use tauri::Manager;
pub struct AppState {
pub db: Mutex<rusqlite::Connection>,
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_dialog::init())
.setup(|app| {
let db_dir = app.path().app_data_dir()?;
std::fs::create_dir_all(&db_dir)?;
let db_path = db_dir.join("orchai.db");
let conn = db::init(&db_path).expect("Failed to initialize database");
app.manage(AppState {
db: Mutex::new(conn),
});
Ok(())
})
.invoke_handler(tauri::generate_handler![
commands::project::create_project,
commands::project::list_projects,
commands::project::get_project,
commands::project::update_project,
commands::project::delete_project,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}