Adding some helpful info for the response body

This commit is contained in:
kdeng00
2025-06-28 16:29:12 -04:00
parent 9750723ba8
commit 04d48515e9
+4 -1
View File
@@ -743,16 +743,19 @@ pub mod endpoint {
let raw_data: Vec<u8> = data.to_vec(); let raw_data: Vec<u8> = data.to_vec();
match song_queue::update(&pool, &raw_data, &id).await { match song_queue::update(&pool, &raw_data, &id).await {
Ok(_queued_data) => { Ok(_) => {
response.subject = String::from("Successful");
response.data.push(id); response.data.push(id);
(axum::http::StatusCode::OK, axum::Json(response)) (axum::http::StatusCode::OK, axum::Json(response))
} }
Err(err) => { Err(err) => {
response.subject = String::from("Error");
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))
} }
} }
} else { } else {
response.subject = String::from("Error");
response.message = String::from("No data provided"); response.message = String::from("No data provided");
(axum::http::StatusCode::NOT_FOUND, axum::Json(response)) (axum::http::StatusCode::NOT_FOUND, axum::Json(response))
} }