tsk-218: Code formatting

This commit is contained in:
kdeng00
2025-10-26 17:19:48 -04:00
parent 04dd4f89e4
commit 389ed2264e
3 changed files with 22 additions and 28 deletions
+18 -19
View File
@@ -37,17 +37,16 @@ pub mod request {
} }
} }
pub mod response { pub mod response {
pub mod song_queue { pub mod song_queue {
/// Song queue response /// Song queue response
#[derive(Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)] #[derive(Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
pub struct Response { pub struct Response {
pub message: String, pub message: String,
/// Id of the queued song /// Id of the queued song
pub data: Vec<uuid::Uuid>, pub data: Vec<uuid::Uuid>,
} }
} }
pub mod fetch_queue_song { pub mod fetch_queue_song {
@@ -99,7 +98,6 @@ pub mod response {
} }
} }
pub mod endpoint { pub mod endpoint {
use axum::response::IntoResponse; use axum::response::IntoResponse;
@@ -121,7 +119,10 @@ pub mod endpoint {
pub async fn queue_song( pub async fn queue_song(
axum::Extension(pool): axum::Extension<sqlx::PgPool>, axum::Extension(pool): axum::Extension<sqlx::PgPool>,
mut multipart: axum::extract::Multipart, mut multipart: axum::extract::Multipart,
) -> (axum::http::StatusCode, axum::Json<super::response::song_queue::Response>) { ) -> (
axum::http::StatusCode,
axum::Json<super::response::song_queue::Response>,
) {
let mut results: Vec<uuid::Uuid> = Vec::new(); let mut results: Vec<uuid::Uuid> = Vec::new();
let mut response = super::response::song_queue::Response::default(); let mut response = super::response::song_queue::Response::default();
@@ -186,8 +187,7 @@ pub mod endpoint {
match repo::song::get_song_queue(&pool, &payload.song_queue_id).await { match repo::song::get_song_queue(&pool, &payload.song_queue_id).await {
Ok(song_queue) => { Ok(song_queue) => {
match repo::song::link_user_id(&pool, &song_queue.id, &payload.user_id).await match repo::song::link_user_id(&pool, &song_queue.id, &payload.user_id).await {
{
Ok(user_id) => { Ok(user_id) => {
response.message = String::from(crate::callers::response::SUCCESSFUL); response.message = String::from(crate::callers::response::SUCCESSFUL);
response.data.push(user_id); response.data.push(user_id);
@@ -271,7 +271,10 @@ pub mod endpoint {
(axum::http::StatusCode::OK, response) (axum::http::StatusCode::OK, response)
} }
Err(_err) => (axum::http::StatusCode::BAD_REQUEST, axum::response::Response::default()), Err(_err) => (
axum::http::StatusCode::BAD_REQUEST,
axum::response::Response::default(),
),
} }
} }
@@ -303,12 +306,8 @@ pub mod endpoint {
if !id.is_nil() { if !id.is_nil() {
match repo::song::get_status_of_song_queue(&pool, &id).await { match repo::song::get_status_of_song_queue(&pool, &id).await {
Ok(old) => { Ok(old) => {
match repo::song::update_song_queue_status( match repo::song::update_song_queue_status(&pool, &payload.status, &id)
&pool, .await
&payload.status,
&id,
)
.await
{ {
Ok(new) => { Ok(new) => {
response.message = String::from("Successful"); response.message = String::from("Successful");
-6
View File
@@ -7,8 +7,6 @@ pub mod request {
pub message: String, pub message: String,
} }
pub mod create_metadata { pub mod create_metadata {
#[derive(Debug, serde::Deserialize, serde::Serialize, utoipa::ToSchema)] #[derive(Debug, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
pub struct Request { pub struct Request {
@@ -68,7 +66,6 @@ pub mod request {
} }
} }
pub mod get_songs { pub mod get_songs {
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)] #[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
pub struct Params { pub struct Params {
@@ -86,7 +83,6 @@ pub mod response {
} }
} }
pub mod get_songs { pub mod get_songs {
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)] #[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
pub struct Response { pub struct Response {
@@ -120,7 +116,6 @@ pub mod endpoint {
use crate::repo; use crate::repo;
use crate::repo::queue as repo_queue; use crate::repo::queue as repo_queue;
/// Endpoint to create song /// Endpoint to create song
#[utoipa::path( #[utoipa::path(
post, post,
@@ -204,7 +199,6 @@ pub mod endpoint {
} }
} }
// Endpoint to get songs // Endpoint to get songs
#[utoipa::path( #[utoipa::path(
get, get,
+4 -3
View File
@@ -178,9 +178,10 @@ pub mod init {
) )
.route( .route(
crate::callers::queue::endpoints::QUEUESONGDATAWIPE, crate::callers::queue::endpoints::QUEUESONGDATAWIPE,
patch(crate::callers::queue::song::endpoint::wipe_data_from_song_queue).route_layer( patch(crate::callers::queue::song::endpoint::wipe_data_from_song_queue)
axum::middleware::from_fn(crate::auth::auth::<axum::body::Body>), .route_layer(axum::middleware::from_fn(
), crate::auth::auth::<axum::body::Body>,
)),
) )
.route( .route(
crate::callers::endpoints::QUEUEMETADATA, crate::callers::endpoints::QUEUEMETADATA,