Response change
This commit is contained in:
+15
-8
@@ -175,10 +175,16 @@ pub mod response {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub mod delete_song {
|
pub mod delete_song {
|
||||||
|
#[derive(Debug, Default, serde::Deserialize, serde::Serialize)]
|
||||||
|
pub struct SongAndCoverArt {
|
||||||
|
pub song: icarus_models::song::Song,
|
||||||
|
pub coverart: icarus_models::coverart::CoverArt
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize)]
|
#[derive(Debug, Default, serde::Deserialize, serde::Serialize)]
|
||||||
pub struct Response {
|
pub struct Response {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
pub data: Vec<(icarus_models::song::Song, icarus_models::coverart::CoverArt)>
|
pub data: Vec<SongAndCoverArt>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1214,32 +1220,33 @@ pub mod endpoint {
|
|||||||
Ok(deleted_coverart) => match std::fs::remove_file(song_path) {
|
Ok(deleted_coverart) => match std::fs::remove_file(song_path) {
|
||||||
Ok(_) => match std::fs::remove_file(&coverart.path) {
|
Ok(_) => match std::fs::remove_file(&coverart.path) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
response.data.push((deleted_song, deleted_coverart));
|
response.message = String::from(super::super::response::SUCCESSFUL);
|
||||||
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
response.data.push(super::response::delete_song::SongAndCoverArt{ song: deleted_song, coverart: deleted_coverart });
|
||||||
|
(axum::http::StatusCode::OK, axum::Json(response))
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = String::from("Could not locate coverart on the filesystem");
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = String::from("Could not locate coverart on the filesystem");
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = String::from("Could not locate coverart on the filesystem");
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = String::from("Could not locate coverart on the filesystem");
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = String::from("Could not locate coverart on the filesystem");
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user