Go
pr CI / Test Suite (pull_request) Failing after 2m30s

This commit is contained in:
2026-08-14 10:12:03 -04:00
parent ffe293d955
commit d20bc830f3
2 changed files with 92 additions and 51 deletions
+48 -7
View File
@@ -167,8 +167,7 @@ pub mod endpoint {
};
match lr.upload(&song.file_key, &data_of_song).await {
Ok(_resp) => {
match repo::song::insert(&pool, &song).await {
Ok(_resp) => match repo::song::insert(&pool, &song).await {
Ok((date_created, id)) => {
song.id = id;
song.date_created = Some(date_created);
@@ -182,8 +181,7 @@ pub mod endpoint {
format!("{:?} song {:?}", err.to_string(), song);
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
}
}
}
},
Err(err) => {
eprintln!("Error: {err:?}");
(
@@ -327,7 +325,21 @@ pub mod endpoint {
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
) -> impl IntoResponse {
match repo::song::get_song(&pool, &id).await {
Ok(song) => {
Ok(mut song) => {
let lab_config = crate::util::maze::get_config();
let lr = labyrinth::Labyrinth { config: lab_config };
match lr.download(&song.file_key).await {
Ok(data) => {
song.filename =
simodels::song::generate_filename(simodels::types::MusicType::FlacExtension, true)
.unwrap();
// Will no longer be needed with s3
song.directory = sienvy::environment::get_root_directory().value;
song.data = data;
match song.save_to_filesystem() {
Ok(_) => {
let song_path = song.song_path().unwrap();
let path = std::path::Path::new(&song_path);
@@ -340,6 +352,7 @@ pub mod endpoint {
Err(_) => return Err((axum::http::StatusCode::NOT_FOUND, "File not found")),
};
let file_size = match file.metadata().await {
Ok(meta) => meta.len(),
Err(_) => {
@@ -359,13 +372,41 @@ pub mod endpoint {
.header("content-length", file_size.to_string())
.body(axum::body::Body::from_stream(stream))
.unwrap();
match song.remove_from_filesystem() {
Ok(_) => {
Ok(rep)
}
Err(err) => {
eprintln!("Error: {err:?}");
Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
"Could not read file",
))
}
}
}
Err(err) => {
eprintln!("Error: {err:?}");
Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
"Could not find file",
))
}
}
}
Err(err) => {
eprintln!("Error: {err:?}");
Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
"Could not find file",
))
}
}
}
Err(_err) => Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
"Could not find file",
)),
))
}
}