feat: load invoice templates from JSON files in data/templates directory
This commit is contained in:
@@ -9,6 +9,7 @@ mod os_detection;
|
||||
|
||||
pub struct AppState {
|
||||
pub db: Mutex<Connection>,
|
||||
pub data_dir: PathBuf,
|
||||
}
|
||||
|
||||
fn get_data_dir() -> PathBuf {
|
||||
@@ -27,6 +28,7 @@ pub fn run() {
|
||||
|
||||
let conn = Connection::open(&db_path).expect("Failed to open database");
|
||||
database::init_db(&conn).expect("Failed to initialize database");
|
||||
commands::seed_default_templates(&data_dir);
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_window_state::Builder::new().build())
|
||||
@@ -35,7 +37,7 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||
.manage(AppState { db: Mutex::new(conn) })
|
||||
.manage(AppState { db: Mutex::new(conn), data_dir: data_dir.clone() })
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::get_clients,
|
||||
commands::create_client,
|
||||
@@ -90,6 +92,7 @@ pub fn run() {
|
||||
commands::save_binary_file,
|
||||
commands::open_mini_timer,
|
||||
commands::close_mini_timer,
|
||||
commands::get_invoice_templates,
|
||||
])
|
||||
.setup(|app| {
|
||||
#[cfg(desktop)]
|
||||
|
||||
Reference in New Issue
Block a user