Code formatting

This commit is contained in:
kdeng00
2025-05-22 14:57:50 -04:00
parent 5a57382739
commit 4d61fd723e
2 changed files with 30 additions and 32 deletions
+15 -14
View File
@@ -197,12 +197,10 @@ pub mod db {
}); });
match result { match result {
Ok(row) => Ok( Ok(row) => Ok(row
row
.try_get("data") .try_get("data")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap()),
),
Err(_) => Err(sqlx::Error::RowNotFound), Err(_) => Err(sqlx::Error::RowNotFound),
} }
} }
@@ -224,12 +222,10 @@ pub mod db {
}); });
match result { match result {
Ok(row) => Ok( Ok(row) => Ok(row
row
.try_get("data") .try_get("data")
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap()),
),
Err(_) => Err(sqlx::Error::RowNotFound), Err(_) => Err(sqlx::Error::RowNotFound),
} }
} }
@@ -358,8 +354,12 @@ pub mod endpoint {
pub async fn fetch_coverart_with_data( pub async fn fetch_coverart_with_data(
axum::Extension(pool): axum::Extension<sqlx::PgPool>, axum::Extension(pool): axum::Extension<sqlx::PgPool>,
axum::extract::Query(params): axum::extract::Query< axum::extract::Query(params): axum::extract::Query<
super::request::fetch_coverart_with_data::Params>, super::request::fetch_coverart_with_data::Params,
) -> (axum::http::StatusCode, axum::Json<super::response::fetch_coverart_with_data::Response>) { >,
) -> (
axum::http::StatusCode,
axum::Json<super::response::fetch_coverart_with_data::Response>,
) {
let mut response = super::response::fetch_coverart_with_data::Response::default(); let mut response = super::response::fetch_coverart_with_data::Response::default();
match params.id { match params.id {
@@ -375,8 +375,10 @@ pub mod endpoint {
} }
}, },
_ => match params.song_queue_id { _ => match params.song_queue_id {
Some(song_queue_id) => { Some(song_queue_id) => match super::db::get_coverart_queue_data_with_song_queue_id(
match super::db::get_coverart_queue_data_with_song_queue_id(&pool, &song_queue_id) &pool,
&song_queue_id,
)
.await .await
{ {
Ok(cover_art_queue) => { Ok(cover_art_queue) => {
@@ -388,8 +390,7 @@ pub mod endpoint {
response.message = err.to_string(); response.message = err.to_string();
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
} }
} },
}
None => { None => {
response.message = String::from("No valid id provided"); response.message = String::from("No valid id provided");
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
+1 -4
View File
@@ -1031,10 +1031,7 @@ mod tests {
axum::http::Request::builder() axum::http::Request::builder()
.method(axum::http::Method::GET) .method(axum::http::Method::GET)
.uri(uri) .uri(uri)
.header( .header(axum::http::header::CONTENT_TYPE, "image/jpeg")
axum::http::header::CONTENT_TYPE,
"image/jpeg",
)
.body(axum::body::Body::empty()) .body(axum::body::Body::empty())
.unwrap(), .unwrap(),
) )