Coverart queue #259
@@ -367,15 +367,6 @@ pub mod endpoint {
|
|||||||
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||||
axum::extract::Path(coverart_queue_id): axum::extract::Path<uuid::Uuid>,
|
axum::extract::Path(coverart_queue_id): axum::extract::Path<uuid::Uuid>,
|
||||||
) -> (axum::http::StatusCode, axum::response::Response) {
|
) -> (axum::http::StatusCode, axum::response::Response) {
|
||||||
match repo::coverart::get_coverart_queue_with_id(&pool, &coverart_queue_id).await {
|
|
||||||
Ok(c) => {
|
|
||||||
println!("C: {c:?}");
|
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
eprintln!("Error: {err:?}");
|
|
||||||
eprintln!("This is wrong");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
match repo::data::queue::coverart::get_with_coverart_queue_id(&pool, &coverart_queue_id)
|
match repo::data::queue::coverart::get_with_coverart_queue_id(&pool, &coverart_queue_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
@@ -470,16 +461,39 @@ pub mod endpoint {
|
|||||||
let coverart_queue_id = payload.coverart_queue_id;
|
let coverart_queue_id = payload.coverart_queue_id;
|
||||||
|
|
||||||
match repo::coverart::get_coverart_queue_with_id(&pool, &coverart_queue_id).await {
|
match repo::coverart::get_coverart_queue_with_id(&pool, &coverart_queue_id).await {
|
||||||
Ok(coverart_queue) => {
|
Ok(_coverart_queue) => {
|
||||||
match repo::coverart::wipe_data(&pool, &coverart_queue.id).await {
|
match repo::data::queue::coverart::get_with_coverart_queue_id(
|
||||||
Ok(id) => {
|
&pool,
|
||||||
response.message = String::from("Success");
|
&coverart_queue_id,
|
||||||
response.data.push(id);
|
)
|
||||||
(axum::http::StatusCode::OK, axum::Json(response))
|
.await
|
||||||
|
{
|
||||||
|
Ok((_id, file_key, _bucket, _region, _)) => {
|
||||||
|
let lab_config = crate::util::maze::get_config();
|
||||||
|
let lr = labyrinth::Labyrinth { config: lab_config };
|
||||||
|
|
||||||
|
match lr.delete(&file_key).await {
|
||||||
|
Ok(_) => {
|
||||||
|
response.message = String::from("Success");
|
||||||
|
response.data.push(coverart_queue_id);
|
||||||
|
|
||||||
|
(axum::http::StatusCode::OK, axum::Json(response))
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("Error: {err:?}");
|
||||||
|
(
|
||||||
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
axum::Json(response),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = err.to_string();
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
(
|
||||||
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
axum::Json(response),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user