tsk-213: Added check for updating queued song

This commit is contained in:
kdeng00
2025-10-29 14:41:31 -04:00
parent 1bf0ed7e19
commit e0d6cbcbf5
+19 -6
View File
@@ -411,15 +411,28 @@ pub mod endpoint {
); );
let raw_data: Vec<u8> = data.to_vec(); let raw_data: Vec<u8> = data.to_vec();
match repo::song::update(&pool, &raw_data, &id).await { match super::is_song_valid(&raw_data).await {
Ok(_) => { Ok(valid) => {
response.message = String::from("Successful"); if valid {
response.data.push(id); match repo::song::update(&pool, &raw_data, &id).await {
(axum::http::StatusCode::OK, axum::Json(response)) Ok(_) => {
response.message = String::from(super::super::super::response::SUCCESSFUL);
response.data.push(id);
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
response.message = err.to_string();
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
}
} else {
response.message = String::from("Invalid song type");
return (axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
}
} }
Err(err) => { Err(err) => {
response.message = err.to_string(); response.message = err.to_string();
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) return (axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response));
} }
} }
} else { } else {