More changes

This commit is contained in:
kdeng00
2025-07-29 16:09:17 -04:00
parent 89fcb5f4f6
commit 016cfab506
+16 -2
View File
@@ -178,7 +178,7 @@ pub mod response {
#[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> pub data: Vec<(icarus_models::song::Song, icarus_models::coverart::CoverArt)>
} }
} }
} }
@@ -1211,13 +1211,27 @@ pub mod endpoint {
match song.song_path() { match song.song_path() {
Ok(song_path) => match super::song_db::delete_song(&pool, &song.id).await { Ok(song_path) => match super::song_db::delete_song(&pool, &song.id).await {
Ok(deleted_song) => match super::super::coverart::cov_db::delete_coverart(&pool, &coverart.id).await { Ok(deleted_song) => match super::super::coverart::cov_db::delete_coverart(&pool, &coverart.id).await {
Ok(deleted_coverart) => { Ok(deleted_coverart) => match std::fs::remove_file(song_path) {
Ok(_) => match std::fs::remove_file(&coverart.path) {
Ok(_) => {
response.data.push((deleted_song, deleted_coverart));
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
} }
Err(err) => { Err(err) => {
response.message = String::from("Could not locate coverart on the filesystem");
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
} }
} }
Err(err) => {
response.message = String::from("Could not locate coverart on the filesystem");
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
}
} }
Err(err) => {
response.message = String::from("Could not locate coverart on the filesystem");
(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 = String::from("Could not locate coverart on the filesystem");