From 4d61fd723ea2c56eab681cf015ac875e3b77f7b2 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Thu, 22 May 2025 14:57:50 -0400 Subject: [PATCH] Code formatting --- src/callers/coverart.rs | 57 +++++++++++++++++++++-------------------- src/main.rs | 5 +--- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/callers/coverart.rs b/src/callers/coverart.rs index 3ce316b..2972dfc 100644 --- a/src/callers/coverart.rs +++ b/src/callers/coverart.rs @@ -197,12 +197,10 @@ pub mod db { }); match result { - Ok(row) => Ok( - row - .try_get("data") - .map_err(|_e| sqlx::Error::RowNotFound) - .unwrap(), - ), + Ok(row) => Ok(row + .try_get("data") + .map_err(|_e| sqlx::Error::RowNotFound) + .unwrap()), Err(_) => Err(sqlx::Error::RowNotFound), } } @@ -224,12 +222,10 @@ pub mod db { }); match result { - Ok(row) => Ok( - row - .try_get("data") - .map_err(|_e| sqlx::Error::RowNotFound) - .unwrap(), - ), + Ok(row) => Ok(row + .try_get("data") + .map_err(|_e| sqlx::Error::RowNotFound) + .unwrap()), Err(_) => Err(sqlx::Error::RowNotFound), } } @@ -358,8 +354,12 @@ pub mod endpoint { pub async fn fetch_coverart_with_data( axum::Extension(pool): axum::Extension, axum::extract::Query(params): axum::extract::Query< - super::request::fetch_coverart_with_data::Params>, - ) -> (axum::http::StatusCode, axum::Json) { + super::request::fetch_coverart_with_data::Params, + >, + ) -> ( + axum::http::StatusCode, + axum::Json, + ) { let mut response = super::response::fetch_coverart_with_data::Response::default(); match params.id { @@ -375,21 +375,22 @@ pub mod endpoint { } }, _ => match params.song_queue_id { - Some(song_queue_id) => { - match super::db::get_coverart_queue_data_with_song_queue_id(&pool, &song_queue_id) - .await - { - Ok(cover_art_queue) => { - response.message = String::from("Successful"); - response.data.push(cover_art_queue); - (axum::http::StatusCode::OK, axum::Json(response)) - } - Err(err) => { - response.message = err.to_string(); - (axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) - } + Some(song_queue_id) => match super::db::get_coverart_queue_data_with_song_queue_id( + &pool, + &song_queue_id, + ) + .await + { + Ok(cover_art_queue) => { + response.message = String::from("Successful"); + response.data.push(cover_art_queue); + (axum::http::StatusCode::OK, axum::Json(response)) } - } + Err(err) => { + response.message = err.to_string(); + (axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) + } + }, None => { response.message = String::from("No valid id provided"); (axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) diff --git a/src/main.rs b/src/main.rs index 1f93116..a155648 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1031,10 +1031,7 @@ mod tests { axum::http::Request::builder() .method(axum::http::Method::GET) .uri(uri) - .header( - axum::http::header::CONTENT_TYPE, - "image/jpeg", - ) + .header(axum::http::header::CONTENT_TYPE, "image/jpeg") .body(axum::body::Body::empty()) .unwrap(), )