use tauri::State; use crate::db::models::Project; use crate::db::queries; use crate::state::AppState; #[tauri::command] pub fn create_project(name: String, state: State) -> Result { let conn = state.db.lock().map_err(|e| e.to_string())?; queries::create_project(&conn, &name).map_err(|e| e.to_string()) } #[tauri::command] pub fn get_project(id: String, state: State) -> Result, String> { let conn = state.db.lock().map_err(|e| e.to_string())?; queries::get_project(&conn, &id).map_err(|e| e.to_string()) } #[tauri::command] pub fn list_projects(state: State) -> Result, String> { let conn = state.db.lock().map_err(|e| e.to_string())?; queries::list_projects(&conn).map_err(|e| e.to_string()) }