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

This commit is contained in:
kdeng00
2025-11-07 11:26:06 -05:00
parent dbbbf02acf
commit 8b70e062a1
+8 -3
View File
@@ -251,9 +251,14 @@ pub mod endpoint {
match repo::song::get_all_songs(&pool).await { match repo::song::get_all_songs(&pool).await {
Ok(songs) => { Ok(songs) => {
response.message = String::from(super::super::response::SUCCESSFUL); if songs.is_empty() {
response.data = songs; response.message = String::from("No songs available");
(axum::http::StatusCode::OK, axum::Json(response)) (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) => { Err(err) => {
response.message = err.to_string(); response.message = err.to_string();