From 88bdfdfc876a842261328e5b956b554c9a2502b3 Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Fri, 15 Nov 2024 23:39:36 -0800 Subject: [PATCH] broken! feat: sqlx query get --- src/router/upload.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/router/upload.rs b/src/router/upload.rs index 634179c..15f9548 100644 --- a/src/router/upload.rs +++ b/src/router/upload.rs @@ -75,6 +75,19 @@ async fn upload_to_zip( let record = UploadRecord::new(archive_path); let mut records = state.records.lock().await; + + if let Some(mut conn) = state.pool.try_acquire() { + let path = record.file.clone().into_os_string().into_string().unwrap(); + + let id = sqlx::query_file!("queries/records/new.sql", path, 5) + .execute(&mut *conn) + .await + .unwrap() + .last_insert_rowid(); + + // TODO: Looks like I actually gotta store cache_name lmfao + }; + records.insert(cache_name.clone(), record.clone()); let records_cache = records.clone();