From 14014c35f894cbff0a96be184b258fd0c7f24e13 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Mon, 18 Aug 2025 19:49:15 -0400 Subject: [PATCH] tsk-176: Formatting --- src/callers/song.rs | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/callers/song.rs b/src/callers/song.rs index 71f44eb..2bfc552 100644 --- a/src/callers/song.rs +++ b/src/callers/song.rs @@ -351,24 +351,25 @@ pub mod song_db { } } - pub async fn get_all_songs(pool: &sqlx::PgPool) -> Result, sqlx::Error> { + pub async fn get_all_songs( + pool: &sqlx::PgPool, + ) -> Result, sqlx::Error> { let result = sqlx::query( r#" SELECT * FROM "song"; - "# - ) - .fetch_all(pool) - .await - .map_err(|e| { - eprintln!("Error querying data: {e:?}"); - }); + "#, + ) + .fetch_all(pool) + .await + .map_err(|e| { + eprintln!("Error querying data: {e:?}"); + }); match result { Ok(rows) => { let mut songs: Vec = Vec::new(); for row in rows { - let date_created_time: time::OffsetDateTime = row .try_get("date_created") .map_err(|_e| sqlx::Error::RowNotFound) @@ -448,9 +449,7 @@ pub mod song_db { Ok(songs) } - Err(_err) => { - Err(sqlx::Error::RowNotFound) - } + Err(_err) => Err(sqlx::Error::RowNotFound), } } @@ -1229,8 +1228,12 @@ pub mod endpoint { } } - pub async fn get_all_songs(axum::Extension(pool): axum::Extension, - ) -> (axum::http::StatusCode, axum::Json) { + pub async fn get_all_songs( + axum::Extension(pool): axum::Extension, + ) -> ( + axum::http::StatusCode, + axum::Json, + ) { let mut response = super::response::get_songs::Response::default(); match super::song_db::get_all_songs(&pool).await {