diff --git a/Cargo.lock b/Cargo.lock index 5395b8d..016840e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -964,7 +964,7 @@ dependencies = [ [[package]] name = "icarus" -version = "0.3.27" +version = "0.3.28" dependencies = [ "axum", "axum-extra", diff --git a/Cargo.toml b/Cargo.toml index 2bc9c48..9f5d8e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "icarus" -version = "0.3.27" +version = "0.3.28" edition = "2024" rust-version = "1.90" diff --git a/src/callers/song.rs b/src/callers/song.rs index 69da51b..2aff68d 100644 --- a/src/callers/song.rs +++ b/src/callers/song.rs @@ -251,9 +251,14 @@ pub mod endpoint { match repo::song::get_all_songs(&pool).await { Ok(songs) => { - response.message = String::from(super::super::response::SUCCESSFUL); - response.data = songs; - (axum::http::StatusCode::OK, axum::Json(response)) + if songs.is_empty() { + response.message = String::from("No songs available"); + (axum::http::StatusCode::NOT_FOUND, axum::Json(response)) + } else { + response.message = String::from(super::super::response::SUCCESSFUL); + response.data = songs; + (axum::http::StatusCode::OK, axum::Json(response)) + } } Err(err) => { response.message = err.to_string();