tsk-176: Formatting
This commit is contained in:
+11
-8
@@ -351,11 +351,13 @@ pub mod song_db {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_all_songs(pool: &sqlx::PgPool) -> Result<Vec<icarus_models::song::Song>, sqlx::Error> {
|
pub async fn get_all_songs(
|
||||||
|
pool: &sqlx::PgPool,
|
||||||
|
) -> Result<Vec<icarus_models::song::Song>, sqlx::Error> {
|
||||||
let result = sqlx::query(
|
let result = sqlx::query(
|
||||||
r#"
|
r#"
|
||||||
SELECT * FROM "song";
|
SELECT * FROM "song";
|
||||||
"#
|
"#,
|
||||||
)
|
)
|
||||||
.fetch_all(pool)
|
.fetch_all(pool)
|
||||||
.await
|
.await
|
||||||
@@ -368,7 +370,6 @@ pub mod song_db {
|
|||||||
let mut songs: Vec<icarus_models::song::Song> = Vec::new();
|
let mut songs: Vec<icarus_models::song::Song> = Vec::new();
|
||||||
|
|
||||||
for row in rows {
|
for row in rows {
|
||||||
|
|
||||||
let date_created_time: time::OffsetDateTime = row
|
let date_created_time: time::OffsetDateTime = row
|
||||||
.try_get("date_created")
|
.try_get("date_created")
|
||||||
.map_err(|_e| sqlx::Error::RowNotFound)
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
@@ -448,9 +449,7 @@ pub mod song_db {
|
|||||||
|
|
||||||
Ok(songs)
|
Ok(songs)
|
||||||
}
|
}
|
||||||
Err(_err) => {
|
Err(_err) => Err(sqlx::Error::RowNotFound),
|
||||||
Err(sqlx::Error::RowNotFound)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1229,8 +1228,12 @@ pub mod endpoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_all_songs(axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
pub async fn get_all_songs(
|
||||||
) -> (axum::http::StatusCode, axum::Json<super::response::get_songs::Response>) {
|
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||||
|
) -> (
|
||||||
|
axum::http::StatusCode,
|
||||||
|
axum::Json<super::response::get_songs::Response>,
|
||||||
|
) {
|
||||||
let mut response = super::response::get_songs::Response::default();
|
let mut response = super::response::get_songs::Response::default();
|
||||||
|
|
||||||
match super::song_db::get_all_songs(&pool).await {
|
match super::song_db::get_all_songs(&pool).await {
|
||||||
|
|||||||
Reference in New Issue
Block a user