tsk-245: Modify result when getting songs but no songs are present (#247)
* tsk-245: Modify result when getting songs but no songs are present * tsk-245: Fixed endpoint indicating success when no content is found * tsk-245: Version bump
This commit was merged in pull request #247.
This commit is contained in:
Generated
+1
-1
@@ -964,7 +964,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icarus"
|
||||
version = "0.3.27"
|
||||
version = "0.3.28"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"axum-extra",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "icarus"
|
||||
version = "0.3.27"
|
||||
version = "0.3.28"
|
||||
edition = "2024"
|
||||
rust-version = "1.90"
|
||||
|
||||
|
||||
+8
-3
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user