tsk-245: Modify result when getting songs but no songs are present #247

Merged
kdeng00 merged 3 commits from tsk-245 into main 2025-11-07 11:48:07 -05:00
Showing only changes of commit 8b70e062a1 - Show all commits
+8 -3
View File
@@ -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();