Got it going
pr CI / Test Suite (pull_request) Failing after 2m51s

This commit is contained in:
2026-08-13 11:35:49 -04:00
parent db8e5458ca
commit 3d211f2e6e
4 changed files with 123 additions and 76 deletions
+41 -10
View File
@@ -508,8 +508,11 @@ pub mod endpoint {
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 };
println!("Valid song");
match repo::data::get_with_song_queue_id(&pool, &song_queue_id).await { match repo::data::get_with_song_queue_id(&pool, &song_queue_id).await {
Ok((id, file_key, _bucket, _region, _)) => match lr.delete(&file_key).await { Ok((id, file_key, _bucket, _region, _)) => {
match lr.delete(&file_key).await {
Ok(_response) => { Ok(_response) => {
let data = labyrinth::Data { let data = labyrinth::Data {
raw_data: raw_data, raw_data: raw_data,
@@ -522,15 +525,25 @@ pub mod endpoint {
) )
.unwrap(); .unwrap();
let new_file_key = format!("queued/song/{filename}"); let new_file_key = format!("queued/song/{filename}");
println!("New key: {new_file_key:?}");
match lr.upload(&new_file_key, &data).await { match lr.upload(&new_file_key, &data).await {
Ok(_) => { Ok(_) => {
match repo::data::update_file_key(&pool, &song_queue_id, &new_file_key).await { match repo::data::update_file_key(
&pool,
&song_queue_id,
&new_file_key,
)
.await
{
Ok(_) => { Ok(_) => {
response.message = response.message =
String::from(super::super::super::response::SUCCESSFUL); String::from(super::super::super::response::SUCCESSFUL);
response.data.push(id); response.data.push(id);
(axum::http::StatusCode::OK, axum::Json(response)) (
axum::http::StatusCode::OK,
axum::Json(response),
)
} }
Err(err) => { Err(err) => {
response.message = err.to_string(); response.message = err.to_string();
@@ -558,6 +571,7 @@ pub mod endpoint {
) )
} }
} }
}
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); eprintln!("Error: {err:?}");
( (
@@ -596,7 +610,8 @@ pub mod endpoint {
), ),
responses( responses(
(status = 200, description = "Queued song data wiped", body = super::response::wipe_data_from_song_queue::Response), (status = 200, description = "Queued song data wiped", body = super::response::wipe_data_from_song_queue::Response),
(status = 404, description = "Queued song cannot be found", body = super::response::wipe_data_from_song_queue::Response) (status = 404, description = "Queued song cannot be found", body = super::response::wipe_data_from_song_queue::Response),
(status = 500, description = "Error wiping song data", body = super::response::wipe_data_from_song_queue::Response)
) )
)] )]
pub async fn wipe_data_from_song_queue( pub async fn wipe_data_from_song_queue(
@@ -607,21 +622,37 @@ pub mod endpoint {
axum::Json<super::response::wipe_data_from_song_queue::Response>, axum::Json<super::response::wipe_data_from_song_queue::Response>,
) { ) {
let mut response = super::response::wipe_data_from_song_queue::Response::default(); let mut response = super::response::wipe_data_from_song_queue::Response::default();
let id = payload.song_queue_id; let song_queue_id = payload.song_queue_id;
match repo::song::get_song_queue(&pool, &id).await { match repo::song::get_song_queue(&pool, &song_queue_id).await {
Ok(song_queue) => match repo::song::wipe_data(&pool, &song_queue.id).await { Ok(_song_queue) => {
Ok(wiped_id) => { match repo::data::get_with_song_queue_id(&pool, &song_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.message = String::from("Success");
response.data.push(wiped_id); response.data.push(song_queue_id);
(axum::http::StatusCode::OK, axum::Json(response)) (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::NOT_FOUND, axum::Json(response)) (axum::http::StatusCode::NOT_FOUND, axum::Json(response))
} }
}, }
}
Err(err) => { Err(err) => {
response.message = err.to_string(); response.message = err.to_string();
(axum::http::StatusCode::NOT_FOUND, axum::Json(response)) (axum::http::StatusCode::NOT_FOUND, axum::Json(response))
+12 -2
View File
@@ -139,7 +139,11 @@ pub mod endpoint {
.unwrap(); .unwrap();
song.directory = sienvy::environment::get_root_directory().value; song.directory = sienvy::environment::get_root_directory().value;
match repo_queue::song::get_data(&pool, &payload.song_queue_id).await { let lab_config = crate::util::maze::get_config();
let lr = labyrinth::Labyrinth { config: lab_config };
match repo_queue::data::get_with_song_queue_id(&pool, &payload.song_queue_id).await {
Ok((_id, file_key, _bucket, _region, _)) => match lr.download(&file_key).await {
Ok(data) => { Ok(data) => {
song.data = data; song.data = data;
let dir = std::path::Path::new(&song.directory); let dir = std::path::Path::new(&song.directory);
@@ -166,7 +170,8 @@ pub mod endpoint {
(axum::http::StatusCode::OK, axum::Json(response)) (axum::http::StatusCode::OK, axum::Json(response))
} }
Err(err) => { Err(err) => {
response.message = format!("{:?} song {:?}", err.to_string(), song); response.message =
format!("{:?} song {:?}", err.to_string(), song);
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
} }
}, },
@@ -179,6 +184,11 @@ pub mod endpoint {
} }
} }
} }
Err(err) => {
eprintln!("Error: {err:?}");
(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, axum::Json(response)) (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
+5 -1
View File
@@ -25,7 +25,11 @@ pub async fn insert(
} }
} }
pub async fn update_file_key(pool: &sqlx::PgPool, id: &uuid::Uuid, file_key: &str) -> Result<(), sqlx::Error> { pub async fn update_file_key(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
file_key: &str,
) -> Result<(), sqlx::Error> {
match sqlx::query( match sqlx::query(
r#" r#"
UPDATE "songQueueData" SET file_key = $1 WHERE id = $2; UPDATE "songQueueData" SET file_key = $1 WHERE id = $2;
+2
View File
@@ -252,6 +252,7 @@ pub async fn get_song_queue(
} }
} }
/*
pub async fn wipe_data(pool: &sqlx::PgPool, id: &uuid::Uuid) -> Result<uuid::Uuid, sqlx::Error> { pub async fn wipe_data(pool: &sqlx::PgPool, id: &uuid::Uuid) -> Result<uuid::Uuid, sqlx::Error> {
let result = sqlx::query( let result = sqlx::query(
r#" r#"
@@ -299,3 +300,4 @@ pub async fn get_data(pool: &sqlx::PgPool, id: &uuid::Uuid) -> Result<Vec<u8>, s
Err(_err) => Err(sqlx::Error::RowNotFound), Err(_err) => Err(sqlx::Error::RowNotFound),
} }
} }
*/