From 9c67bfd8a8416ad2e9aa905ed0246ff47b501f83 Mon Sep 17 00:00:00 2001 From: KD Date: Sat, 28 Jun 2025 16:45:25 -0400 Subject: [PATCH] Update song queue changes (#145) * Updated gitignore to disregard some .env files .env.docker and .env.local. Primarily used for switching between local and docker development * Changed PATCH /api/v2/song/queue/{id} endpoint Modified the response body. Will just return a list of song queue id * Adding some helpful info for the response body * Tidying up and making some changes * Code formatting --- .gitignore | 2 ++ src/callers/song.rs | 7 ++++--- src/main.rs | 7 +++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 01dee51..338e3e6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ /target .env +.env.docker +.env.local .DS_STORE Storage/ diff --git a/src/callers/song.rs b/src/callers/song.rs index ed9b13b..046c197 100644 --- a/src/callers/song.rs +++ b/src/callers/song.rs @@ -123,7 +123,7 @@ pub mod response { #[derive(Default, serde::Deserialize, serde::Serialize)] pub struct Response { pub message: String, - pub data: Vec>, + pub data: Vec, } } @@ -743,8 +743,9 @@ pub mod endpoint { let raw_data: Vec = data.to_vec(); match song_queue::update(&pool, &raw_data, &id).await { - Ok(queued_data) => { - response.data.push(queued_data); + Ok(_) => { + response.message = String::from("Successful"); + response.data.push(id); (axum::http::StatusCode::OK, axum::Json(response)) } Err(err) => { diff --git a/src/main.rs b/src/main.rs index 472838c..450a5af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -822,6 +822,13 @@ mod tests { resp.data.is_empty(), "Should not be empty" ); + + let updated_song_queued_id = resp.data[0]; + assert_eq!( + updated_song_queued_id, *id, + "Song queue Id should match, but they don't. {:?} {:?}", + updated_song_queued_id, id + ); } Err(err) => { assert!(false, "Error: {:?}", err);