Endpoint now available

This commit is contained in:
kdeng00
2025-05-20 20:20:27 -04:00
parent 3e04a6afb8
commit e3546ffa07
2 changed files with 10 additions and 6 deletions
+6 -6
View File
@@ -332,7 +332,7 @@ pub mod endpoint {
pub async fn update_song_queue_status(
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
axum::Json(payload): axum::Json<super::request::update_status::Request>,
) -> (axum::http::StatusCode, super::response::update_status::Response) {
) -> (axum::http::StatusCode, axum::Json<super::response::update_status::Response>) {
let mut response = super::response::update_status::Response::default();
if super::status::is_valid(&payload.status).await {
@@ -347,26 +347,26 @@ pub mod endpoint {
old_status: old,
new_status: new
});
(axum::http::StatusCode::OK, response)
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
response.message = err.to_string();
(axum::http::StatusCode::BAD_REQUEST, response)
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
}
}
Err(err) => {
response.message = err.to_string();
(axum::http::StatusCode::BAD_REQUEST, response)
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
}
} else {
response.message = String::from("Id is nil");
(axum::http::StatusCode::BAD_REQUEST, response)
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
} else {
response.message = String::from("Status not valid");
(axum::http::StatusCode::BAD_REQUEST, response)
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
}
}
+4
View File
@@ -69,6 +69,10 @@ pub mod init {
crate::callers::endpoints::QUEUESONG,
post(crate::callers::song::endpoint::queue_song),
)
.route(
crate::callers::endpoints::QUEUESONG,
patch(crate::callers::song::endpoint::update_song_queue_status),
)
.route(
crate::callers::endpoints::QUEUESONGDATA,
get(crate::callers::song::endpoint::download_flac),