Get songs endpoint #162

Merged
kdeng00 merged 27 commits from get_songs into v0.2 2025-07-25 18:20:28 -04:00
Showing only changes of commit de3b96f0e0 - Show all commits
+11 -7
View File
@@ -96,7 +96,7 @@ pub mod request {
pub mod get_songs { pub mod get_songs {
#[derive(Debug, Default, serde::Deserialize, serde::Serialize)] #[derive(Debug, Default, serde::Deserialize, serde::Serialize)]
pub struct Params { pub struct Params {
pub id: Option<uuid::Uuid> pub id: Option<uuid::Uuid>,
} }
} }
} }
@@ -170,7 +170,7 @@ pub mod response {
#[derive(Debug, Default, serde::Deserialize, serde::Serialize)] #[derive(Debug, Default, serde::Deserialize, serde::Serialize)]
pub struct Response { pub struct Response {
pub message: String, pub message: String,
pub data: Vec<i32> pub data: Vec<i32>,
} }
} }
} }
@@ -984,11 +984,15 @@ pub mod endpoint {
} }
} }
pub async fn get_songs(axum::Extension(pool): axum::Extension<sqlx::PgPool>, pub async fn get_songs(
axum::extract::Query(params): axum::extract::Query<super::request::get_songs::Params>) axum::Extension(pool): axum::Extension<sqlx::PgPool>,
-> (axum::http::StatusCode, Json<super::response::get_songs::Response>) { axum::extract::Query(params): axum::extract::Query<super::request::get_songs::Params>,
let mut response = super::response::get_songs::Response::default(); ) -> (
axum::http::StatusCode,
Json<super::response::get_songs::Response>,
) {
let mut response = super::response::get_songs::Response::default();
(axum::http::StatusCode::OK, axum::Json(response)) (axum::http::StatusCode::OK, axum::Json(response))
} }
} }