diff --git a/src/callers/queue/coverart.rs b/src/callers/queue/coverart.rs index 30bc38e..7fb4b8b 100644 --- a/src/callers/queue/coverart.rs +++ b/src/callers/queue/coverart.rs @@ -205,7 +205,8 @@ pub mod endpoint { .await { Ok(id) => { - match repo::data::insert( + println!("Inserting queued data"); + match repo::data::queue::coverart::insert( &pool, &file_path, &lr.config.bucket, @@ -215,6 +216,7 @@ pub mod endpoint { .await { Ok(_id) => { + println!("Successfully did it"); response.message = String::from("Successful"); response.data.push(id); (axum::http::StatusCode::OK, axum::Json(response)) @@ -363,9 +365,20 @@ pub mod endpoint { )] pub async fn fetch_coverart_with_data( axum::Extension(pool): axum::Extension, - axum::extract::Path(id): axum::extract::Path, + axum::extract::Path(coverart_queue_id): axum::extract::Path, ) -> (axum::http::StatusCode, axum::response::Response) { - match repo::data::queue::coverart::get_with_coverart_queue_id(&pool, &id).await { + match repo::coverart::get_coverart_queue_with_id(&pool, &coverart_queue_id).await { + Ok(c) => { + println!("C: {c:?}"); + } + Err(err) => { + eprintln!("Error: {err:?}"); + eprintln!("This is wrong"); + } + } + match repo::data::queue::coverart::get_with_coverart_queue_id(&pool, &coverart_queue_id) + .await + { Ok((_id, file_key, _bucket, _region, _)) => { let lab_config = crate::util::maze::get_config(); let lr = labyrinth::Labyrinth { config: lab_config }; @@ -421,6 +434,7 @@ pub mod endpoint { } } Err(err) => { + eprintln!("Record not found"); eprintln!("Error: {err:?}"); ( axum::http::StatusCode::INTERNAL_SERVER_ERROR, diff --git a/src/repo/queue/data.rs b/src/repo/queue/data.rs index 5a7503d..bd6e818 100644 --- a/src/repo/queue/data.rs +++ b/src/repo/queue/data.rs @@ -109,21 +109,24 @@ pub mod queue { coverart_queue_id: &uuid::Uuid, ) -> Result { match sqlx::query( - r#" - INSERT INTO "coverartQueueData" (file_key, bucket, region, coverart_queue_id) VALUES($1, $2, $3, $4) RETURNING id; + r#" + INSERT INTO "coverartQueueData" (file_key, bucket, region, coverart_queue_id) + VALUES($1, $2, $3, $4) RETURNING id; "#, - ) - .bind(file_key) - .bind(bucket) - .bind(region) - .bind(coverart_queue_id) - .fetch_one(pool).await { - Ok(row) => { - let id: uuid::Uuid = row.try_get("id")?; - Ok(id) - } - Err(_err) => Err(sqlx::Error::RowNotFound), + ) + .bind(file_key) + .bind(bucket) + .bind(region) + .bind(coverart_queue_id) + .fetch_one(pool) + .await + { + Ok(row) => { + let id: uuid::Uuid = row.try_get("id")?; + Ok(id) } + Err(_err) => Err(sqlx::Error::RowNotFound), + } } pub async fn update_file_key(