Formatting

This commit is contained in:
kdeng00
2025-04-29 21:37:24 -04:00
parent fe818fc154
commit 07eead8b92
2 changed files with 56 additions and 55 deletions
+8 -10
View File
@@ -171,9 +171,11 @@ pub mod metadata_queue {
}); });
match result { match result {
Ok(row) => Ok(row) => {
{ let data: serde_json::Value = row
let data: serde_json::Value = row.try_get("metadata").map_err(|_e| sqlx::Error::RowNotFound).unwrap(); .try_get("metadata")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap();
Ok(MetadataQueue { Ok(MetadataQueue {
id: row id: row
.try_get("id") .try_get("id")
@@ -189,11 +191,10 @@ pub mod metadata_queue {
.map_err(|_e| sqlx::Error::RowNotFound) .map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(), .unwrap(),
}) })
}, }
Err(_err) => Err(sqlx::Error::RowNotFound), Err(_err) => Err(sqlx::Error::RowNotFound),
} }
} }
} }
pub mod endpoint { pub mod endpoint {
@@ -235,7 +236,6 @@ pub mod endpoint {
Some(id) => { Some(id) => {
println!("Something works {:?}", id); println!("Something works {:?}", id);
match super::metadata_queue::get_with_id(&pool, &id).await { match super::metadata_queue::get_with_id(&pool, &id).await {
Ok(item) => { Ok(item) => {
response.message = String::from("Successful"); response.message = String::from("Successful");
@@ -248,8 +248,7 @@ pub mod endpoint {
} }
} }
} }
_ => { _ => match params.song_queue_id {
match params.song_queue_id {
Some(song_queue_id) => { Some(song_queue_id) => {
println!("Song queue Id is probably not nil"); println!("Song queue Id is probably not nil");
match super::metadata_queue::get_with_song_queue_id(&pool, &song_queue_id).await match super::metadata_queue::get_with_song_queue_id(&pool, &song_queue_id).await
@@ -269,8 +268,7 @@ pub mod endpoint {
println!("What is going on?"); println!("What is going on?");
(StatusCode::BAD_REQUEST, Json(response)) (StatusCode::BAD_REQUEST, Json(response))
} }
} },
}
} }
} }
} }
+7 -4
View File
@@ -565,7 +565,9 @@ mod tests {
let id = resp.data[0]; let id = resp.data[0];
let uri = format!("{}?id={}", crate::callers::endpoints::QUEUEMETADATA, id); let uri = format!("{}?id={}", crate::callers::endpoints::QUEUEMETADATA, id);
match app.clone().oneshot( match app
.clone()
.oneshot(
axum::http::Request::builder() axum::http::Request::builder()
.method(axum::http::Method::GET) .method(axum::http::Method::GET)
// .uri(crate::callers::endpoints::QUEUEMETADATA) // .uri(crate::callers::endpoints::QUEUEMETADATA)
@@ -574,9 +576,10 @@ mod tests {
// .body(axum::body::Body::from(new_payload.to_string())) // .body(axum::body::Body::from(new_payload.to_string()))
.body(axum::body::Body::empty()) .body(axum::body::Body::empty())
.unwrap(), .unwrap(),
).await { )
Ok(response) => { .await
} {
Ok(response) => {}
Err(err) => { Err(err) => {
assert!(false, "Error: {:?}", err); assert!(false, "Error: {:?}", err);
} }