Get metadata #126
+8
-10
@@ -171,9 +171,11 @@ pub mod metadata_queue {
|
||||
});
|
||||
|
||||
match result {
|
||||
Ok(row) =>
|
||||
{
|
||||
let data: serde_json::Value = row.try_get("metadata").map_err(|_e| sqlx::Error::RowNotFound).unwrap();
|
||||
Ok(row) => {
|
||||
let data: serde_json::Value = row
|
||||
.try_get("metadata")
|
||||
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||
.unwrap();
|
||||
Ok(MetadataQueue {
|
||||
id: row
|
||||
.try_get("id")
|
||||
@@ -189,11 +191,10 @@ pub mod metadata_queue {
|
||||
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||
.unwrap(),
|
||||
})
|
||||
},
|
||||
}
|
||||
Err(_err) => Err(sqlx::Error::RowNotFound),
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub mod endpoint {
|
||||
@@ -235,7 +236,6 @@ pub mod endpoint {
|
||||
Some(id) => {
|
||||
println!("Something works {:?}", id);
|
||||
|
||||
|
||||
match super::metadata_queue::get_with_id(&pool, &id).await {
|
||||
Ok(item) => {
|
||||
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) => {
|
||||
println!("Song queue Id is probably not nil");
|
||||
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?");
|
||||
(StatusCode::BAD_REQUEST, Json(response))
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-4
@@ -565,7 +565,9 @@ mod tests {
|
||||
let id = resp.data[0];
|
||||
let uri = format!("{}?id={}", crate::callers::endpoints::QUEUEMETADATA, id);
|
||||
|
||||
match app.clone().oneshot(
|
||||
match app
|
||||
.clone()
|
||||
.oneshot(
|
||||
axum::http::Request::builder()
|
||||
.method(axum::http::Method::GET)
|
||||
// .uri(crate::callers::endpoints::QUEUEMETADATA)
|
||||
@@ -574,9 +576,10 @@ mod tests {
|
||||
// .body(axum::body::Body::from(new_payload.to_string()))
|
||||
.body(axum::body::Body::empty())
|
||||
.unwrap(),
|
||||
).await {
|
||||
Ok(response) => {
|
||||
}
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(response) => {}
|
||||
Err(err) => {
|
||||
assert!(false, "Error: {:?}", err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user