From 329ba60dfcc9d601d422fcae018c94b5dc0ee20d Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sat, 28 Jun 2025 16:23:45 -0400 Subject: [PATCH 1/5] Updated gitignore to disregard some .env files .env.docker and .env.local. Primarily used for switching between local and docker development --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) 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/ -- 2.47.3 From 9750723ba8001edd68a914424aa7a92f4c9e2bca Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sat, 28 Jun 2025 16:25:33 -0400 Subject: [PATCH 2/5] Changed PATCH /api/v2/song/queue/{id} endpoint Modified the response body. Will just return a list of song queue id --- src/callers/song.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/callers/song.rs b/src/callers/song.rs index ed9b13b..87b1a51 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,8 @@ 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(_queued_data) => { + response.data.push(id); (axum::http::StatusCode::OK, axum::Json(response)) } Err(err) => { -- 2.47.3 From 04d48515e999d8658cda127a21a7fcf17abfab06 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sat, 28 Jun 2025 16:29:12 -0400 Subject: [PATCH 3/5] Adding some helpful info for the response body --- src/callers/song.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/callers/song.rs b/src/callers/song.rs index 87b1a51..c10293a 100644 --- a/src/callers/song.rs +++ b/src/callers/song.rs @@ -743,16 +743,19 @@ pub mod endpoint { let raw_data: Vec = data.to_vec(); match song_queue::update(&pool, &raw_data, &id).await { - Ok(_queued_data) => { + Ok(_) => { + response.subject = String::from("Successful"); response.data.push(id); (axum::http::StatusCode::OK, axum::Json(response)) } Err(err) => { + response.subject = String::from("Error"); response.message = err.to_string(); (axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) } } } else { + response.subject = String::from("Error"); response.message = String::from("No data provided"); (axum::http::StatusCode::NOT_FOUND, axum::Json(response)) } -- 2.47.3 From 5c5c043adecefb14f023f3cd8dcbbcad20396e64 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sat, 28 Jun 2025 16:38:22 -0400 Subject: [PATCH 4/5] Tidying up and making some changes --- src/callers/song.rs | 4 +--- src/main.rs | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/callers/song.rs b/src/callers/song.rs index c10293a..046c197 100644 --- a/src/callers/song.rs +++ b/src/callers/song.rs @@ -744,18 +744,16 @@ pub mod endpoint { let raw_data: Vec = data.to_vec(); match song_queue::update(&pool, &raw_data, &id).await { Ok(_) => { - response.subject = String::from("Successful"); + response.message = String::from("Successful"); response.data.push(id); (axum::http::StatusCode::OK, axum::Json(response)) } Err(err) => { - response.subject = String::from("Error"); response.message = err.to_string(); (axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) } } } else { - response.subject = String::from("Error"); response.message = String::from("No data provided"); (axum::http::StatusCode::NOT_FOUND, axum::Json(response)) } diff --git a/src/main.rs b/src/main.rs index 472838c..ecb81f2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -822,6 +822,9 @@ 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); -- 2.47.3 From e7d853399f0302c36df94f611689ae9b288403f6 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sat, 28 Jun 2025 16:38:56 -0400 Subject: [PATCH 5/5] Code formatting --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ecb81f2..450a5af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -824,7 +824,11 @@ mod tests { ); 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); + 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); -- 2.47.3