Tidying up and making some changes
This commit is contained in:
+1
-3
@@ -744,18 +744,16 @@ 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(_) => {
|
Ok(_) => {
|
||||||
response.subject = String::from("Successful");
|
response.message = 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))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -822,6 +822,9 @@ mod tests {
|
|||||||
resp.data.is_empty(),
|
resp.data.is_empty(),
|
||||||
"Should not be empty"
|
"Should not be empty"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let updated_song_queued_id = resp.data[0];
|
||||||
|
assert_eq!(updated_song_queued_id, *id, "Song queue Id should match, but they don't. {:?} {:?}", updated_song_queued_id, id);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
assert!(false, "Error: {:?}", err);
|
assert!(false, "Error: {:?}", err);
|
||||||
|
|||||||
Reference in New Issue
Block a user