Endpoint now available
This commit is contained in:
+6
-6
@@ -332,7 +332,7 @@ pub mod endpoint {
|
|||||||
pub async fn update_song_queue_status(
|
pub async fn update_song_queue_status(
|
||||||
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||||
axum::Json(payload): axum::Json<super::request::update_status::Request>,
|
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();
|
let mut response = super::response::update_status::Response::default();
|
||||||
|
|
||||||
if super::status::is_valid(&payload.status).await {
|
if super::status::is_valid(&payload.status).await {
|
||||||
@@ -347,26 +347,26 @@ pub mod endpoint {
|
|||||||
old_status: old,
|
old_status: old,
|
||||||
new_status: new
|
new_status: new
|
||||||
});
|
});
|
||||||
(axum::http::StatusCode::OK, response)
|
(axum::http::StatusCode::OK, axum::Json(response))
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = err.to_string();
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::BAD_REQUEST, response)
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = err.to_string();
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::BAD_REQUEST, response)
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response.message = String::from("Id is nil");
|
response.message = String::from("Id is nil");
|
||||||
(axum::http::StatusCode::BAD_REQUEST, response)
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response.message = String::from("Status not valid");
|
response.message = String::from("Status not valid");
|
||||||
(axum::http::StatusCode::BAD_REQUEST, response)
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ pub mod init {
|
|||||||
crate::callers::endpoints::QUEUESONG,
|
crate::callers::endpoints::QUEUESONG,
|
||||||
post(crate::callers::song::endpoint::queue_song),
|
post(crate::callers::song::endpoint::queue_song),
|
||||||
)
|
)
|
||||||
|
.route(
|
||||||
|
crate::callers::endpoints::QUEUESONG,
|
||||||
|
patch(crate::callers::song::endpoint::update_song_queue_status),
|
||||||
|
)
|
||||||
.route(
|
.route(
|
||||||
crate::callers::endpoints::QUEUESONGDATA,
|
crate::callers::endpoints::QUEUESONGDATA,
|
||||||
get(crate::callers::song::endpoint::download_flac),
|
get(crate::callers::song::endpoint::download_flac),
|
||||||
|
|||||||
Reference in New Issue
Block a user