From 8b70e062a14571c187837a8f4172b307bdf69095 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Fri, 7 Nov 2025 11:26:06 -0500 Subject: [PATCH 1/3] tsk-245: Modify result when getting songs but no songs are present --- src/callers/song.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/callers/song.rs b/src/callers/song.rs index 69da51b..1dd9690 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::NO_CONTENT, 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(); -- 2.47.3 From ef173d317047c0c389c07436acded9eb6983f656 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Fri, 7 Nov 2025 11:36:54 -0500 Subject: [PATCH 2/3] tsk-245: Fixed endpoint indicating success when no content is found --- src/callers/song.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/callers/song.rs b/src/callers/song.rs index 1dd9690..2aff68d 100644 --- a/src/callers/song.rs +++ b/src/callers/song.rs @@ -253,7 +253,7 @@ pub mod endpoint { Ok(songs) => { if songs.is_empty() { response.message = String::from("No songs available"); - (axum::http::StatusCode::NO_CONTENT, axum::Json(response)) + (axum::http::StatusCode::NOT_FOUND, axum::Json(response)) } else { response.message = String::from(super::super::response::SUCCESSFUL); response.data = songs; -- 2.47.3 From fb64b92226beb56c616df59331d1faeec23f88be Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Fri, 7 Nov 2025 11:42:42 -0500 Subject: [PATCH 3/3] tsk-245: Version bump --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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" -- 2.47.3