@@ -367,15 +367,6 @@ pub mod endpoint {
|
||||
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||
axum::extract::Path(coverart_queue_id): axum::extract::Path<uuid::Uuid>,
|
||||
) -> (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)
|
||||
.await
|
||||
{
|
||||
@@ -470,16 +461,39 @@ pub mod endpoint {
|
||||
let coverart_queue_id = payload.coverart_queue_id;
|
||||
|
||||
match repo::coverart::get_coverart_queue_with_id(&pool, &coverart_queue_id).await {
|
||||
Ok(coverart_queue) => {
|
||||
match repo::coverart::wipe_data(&pool, &coverart_queue.id).await {
|
||||
Ok(id) => {
|
||||
response.message = String::from("Success");
|
||||
response.data.push(id);
|
||||
(axum::http::StatusCode::OK, axum::Json(response))
|
||||
Ok(_coverart_queue) => {
|
||||
match repo::data::queue::coverart::get_with_coverart_queue_id(
|
||||
&pool,
|
||||
&coverart_queue_id,
|
||||
)
|
||||
.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) => {
|
||||
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