Progress towards inventory

This commit is contained in:
Bianca Fürstenau 2025-02-20 05:26:53 +01:00
parent 48ec66d64b
commit aecde207f9
3 changed files with 95 additions and 15 deletions

View file

@ -83,7 +83,7 @@ fn put_client(file: &str, payload: &[u8]) -> Result<Easy2<Collector>, ()> {
#[tauri::command]
pub async fn pull_data(
state: State<'_, Mutex<AppState>>,
_state: State<'_, Mutex<AppState>>,
) -> Result<String, ()> {
let mut client = data_client("")?;
client.custom_request("PROPFIND").map_err(|_| ())?;
@ -95,8 +95,8 @@ pub async fn pull_data(
async fn push_key(id: &u64, key: &SigningKey) -> Result<(), ()> {
let file = format!("{:016X}.key", id);
let v_key = key.verifying_key();
let mut client = put_client(&file, v_key.as_ref())?;
let perf = client.perform()
let client = put_client(&file, v_key.as_ref())?;
let _perf = client.perform()
.map_err(|e| println!("{:?}", e))?;
Ok(())
}
@ -109,8 +109,8 @@ fn push_db(id: &u64, db: &Connection, app: tauri::AppHandle) -> Result<(), ()> {
.map_err(|e| println!("{:?}", e))?;
let buf = std::fs::read(&path)
.map_err(|e| println!("{:?}", e))?;
let mut client = put_client(&filename, buf.as_ref())?;
let perf = client.perform()
let client = put_client(&filename, buf.as_ref())?;
let _perf = client.perform()
.map_err(|e| println!("{:?}", e))?;
Ok(())
}
@ -122,6 +122,6 @@ pub async fn push_data(
) -> Result<(), ()> {
let state = state.lock().await;
push_key(&state.id, &state.key).await?;
push_db(&state.id, &state.db, app);
push_db(&state.id, &state.db, app)?;
Ok(())
}