tsk-213: Identify audio file type in initial step when queueing #225
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user