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]]
|
[[package]]
|
||||||
name = "icarus"
|
name = "icarus"
|
||||||
version = "0.3.27"
|
version = "0.3.28"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-extra",
|
"axum-extra",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "icarus"
|
name = "icarus"
|
||||||
version = "0.3.27"
|
version = "0.3.28"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.90"
|
rust-version = "1.90"
|
||||||
|
|
||||||
|
|||||||
+8
-3
@@ -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::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) => {
|
Err(err) => {
|
||||||
response.message = err.to_string();
|
response.message = err.to_string();
|
||||||
|
|||||||
Reference in New Issue
Block a user