mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-23 09:51:10 +01:00
Create new workspace, and more optimizations
This commit is contained in:
@@ -226,6 +226,23 @@ async fn set_key_value(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn create_workspace(
|
||||
name: &str,
|
||||
app_handle: AppHandle<Wry>,
|
||||
db_instance: State<'_, Mutex<Pool<Sqlite>>>,
|
||||
) -> Result<String, String> {
|
||||
let pool = &*db_instance.lock().await;
|
||||
let created_workspace =
|
||||
models::create_workspace(name, "", pool).await.expect("Failed to create workspace");
|
||||
|
||||
app_handle
|
||||
.emit_all("updated_workspace", &created_workspace)
|
||||
.unwrap();
|
||||
|
||||
Ok(created_workspace.id)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn create_request(
|
||||
workspace_id: &str,
|
||||
@@ -478,6 +495,7 @@ fn main() {
|
||||
requests,
|
||||
send_request,
|
||||
create_request,
|
||||
create_workspace,
|
||||
update_request,
|
||||
delete_request,
|
||||
responses,
|
||||
|
||||
Reference in New Issue
Block a user