tsk-268: Extending functionality
pr CI / Test Suite (pull_request) Failing after 3m19s

This commit is contained in:
phoenix committed 2026-11-06 16:34:45 -05:00
1 parent 0f15c141c6
commit 3e1bd59aa3
1 file changed
+26 -6
+26 -6
View File
@@ -11,6 +11,7 @@ pub mod request {
#[derive(Debug, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
pub struct Params {
pub id: Option<uuid::Uuid>,
pub song_id: Option<uuid::Uuid>,
}
}
}
@@ -181,7 +182,8 @@ pub mod endpoint {
get,
path = super::super::endpoints::GETCOVERART,
params(
("id" = uuid::Uuid, Path, description = "Cover art Id")
("id" = uuid::Uuid, Path, description = "Cover art Id"),
("song_id" = uuid::Uuid, Path, description = "Song Id")
),
responses(
(status = 200, description = "Cover art retrieved", body = super::response::get_coverart::Response),
@@ -201,7 +203,7 @@ pub mod endpoint {
Some(id) => match repo::coverart::get_coverart(&pool, &id).await {
Ok(coverart) => {
response.data.push(coverart);
response.message = String::from(super::super::response::SUCCESSFUL);
response.message = super::super::response::SUCCESSFUL.to_string();
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
@@ -209,10 +211,28 @@ pub mod endpoint {
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
},
None => {
response.message = String::from("Invalid parameters");
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
_ => match params.song_id {
Some(song_id) => {
match repo::coverart::get_coverart_with_song_id(&pool, &song_id).await {
Ok(coverart) => {
response.data.push(coverart);
response.message = super::super::response::SUCCESSFUL.to_string();
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
response.message = err.to_string();
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
}
}
None => {
response.message = "Invalid parameters".to_string();
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
},
}
}