Coverart queue #259
@@ -205,7 +205,8 @@ pub mod endpoint {
|
||||
.await
|
||||
{
|
||||
Ok(id) => {
|
||||
match repo::data::insert(
|
||||
println!("Inserting queued data");
|
||||
match repo::data::queue::coverart::insert(
|
||||
&pool,
|
||||
&file_path,
|
||||
&lr.config.bucket,
|
||||
@@ -215,6 +216,7 @@ pub mod endpoint {
|
||||
.await
|
||||
{
|
||||
Ok(_id) => {
|
||||
println!("Successfully did it");
|
||||
response.message = String::from("Successful");
|
||||
response.data.push(id);
|
||||
(axum::http::StatusCode::OK, axum::Json(response))
|
||||
@@ -363,9 +365,20 @@ pub mod endpoint {
|
||||
)]
|
||||
pub async fn fetch_coverart_with_data(
|
||||
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
|
||||
axum::extract::Path(coverart_queue_id): axum::extract::Path<uuid::Uuid>,
|
||||
) -> (axum::http::StatusCode, axum::response::Response) {
|
||||
match repo::data::queue::coverart::get_with_coverart_queue_id(&pool, &id).await {
|
||||
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
|
||||
{
|
||||
Ok((_id, file_key, _bucket, _region, _)) => {
|
||||
let lab_config = crate::util::maze::get_config();
|
||||
let lr = labyrinth::Labyrinth { config: lab_config };
|
||||
@@ -421,6 +434,7 @@ pub mod endpoint {
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("Record not found");
|
||||
eprintln!("Error: {err:?}");
|
||||
(
|
||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||
|
||||
@@ -110,14 +110,17 @@ pub mod queue {
|
||||
) -> Result<uuid::Uuid, sqlx::Error> {
|
||||
match sqlx::query(
|
||||
r#"
|
||||
INSERT INTO "coverartQueueData" (file_key, bucket, region, coverart_queue_id) VALUES($1, $2, $3, $4) RETURNING id;
|
||||
INSERT INTO "coverartQueueData" (file_key, bucket, region, coverart_queue_id)
|
||||
VALUES($1, $2, $3, $4) RETURNING id;
|
||||
"#,
|
||||
)
|
||||
.bind(file_key)
|
||||
.bind(bucket)
|
||||
.bind(region)
|
||||
.bind(coverart_queue_id)
|
||||
.fetch_one(pool).await {
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
{
|
||||
Ok(row) => {
|
||||
let id: uuid::Uuid = row.try_get("id")?;
|
||||
Ok(id)
|
||||
|
||||
Reference in New Issue
Block a user