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