tsk-199: Code formatting

This commit is contained in:
kdeng00
2025-10-24 21:43:30 -04:00
parent 6d4b2decec
commit bcee2057b7
4 changed files with 22 additions and 32 deletions
-3
View File
@@ -33,14 +33,12 @@ pub mod response {
} }
} }
pub mod endpoint { pub mod endpoint {
use axum::response::IntoResponse; use axum::response::IntoResponse;
use crate::repo; use crate::repo;
use crate::repo::queue as repo_queue; use crate::repo::queue as repo_queue;
/// Endpoint to create cover art /// Endpoint to create cover art
#[utoipa::path( #[utoipa::path(
post, post,
@@ -122,7 +120,6 @@ pub mod endpoint {
} }
} }
/// Endpoint to get cover art with criteria /// Endpoint to get cover art with criteria
#[utoipa::path( #[utoipa::path(
get, get,
+3 -10
View File
@@ -51,7 +51,6 @@ pub mod request {
} }
} }
pub mod response { pub mod response {
pub mod queue { pub mod queue {
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)] #[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
@@ -100,7 +99,6 @@ pub mod response {
} }
} }
mod helper { mod helper {
pub fn is_coverart_file_type_valid(file_type: &String) -> bool { pub fn is_coverart_file_type_valid(file_type: &String) -> bool {
let valid_file_types = vec![ let valid_file_types = vec![
@@ -119,13 +117,11 @@ mod helper {
} }
} }
pub mod endpoint { pub mod endpoint {
use axum::response::IntoResponse; use axum::response::IntoResponse;
use crate::repo::queue as repo; use crate::repo::queue as repo;
/// Endpoint to queue cover art /// Endpoint to queue cover art
#[utoipa::path( #[utoipa::path(
post, post,
@@ -183,8 +179,7 @@ pub mod endpoint {
file_type file_type
); );
match repo::coverart::insert(&pool, &raw_data, &file_type.file_type).await match repo::coverart::insert(&pool, &raw_data, &file_type.file_type).await {
{
Ok(id) => { Ok(id) => {
response.message = String::from("Successful"); response.message = String::from("Successful");
response.data.push(id); response.data.push(id);
@@ -283,8 +278,7 @@ pub mod endpoint {
} }
}, },
_ => match params.song_queue_id { _ => match params.song_queue_id {
Some(song_queue_id) => { Some(song_queue_id) => match repo::coverart::get_coverart_queue_with_song_queue_id(
match repo::coverart::get_coverart_queue_with_song_queue_id(
&pool, &pool,
&song_queue_id, &song_queue_id,
) )
@@ -299,8 +293,7 @@ pub mod endpoint {
response.message = err.to_string(); response.message = err.to_string();
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
} }
} },
}
None => { None => {
response.message = String::from("No valid id provided"); response.message = String::from("No valid id provided");
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response)) (axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
-1
View File
@@ -1,2 +1 @@
pub mod coverart; pub mod coverart;
+6 -5
View File
@@ -58,12 +58,12 @@ pub mod init {
use crate::callers::song as song_caller; use crate::callers::song as song_caller;
use coverart_caller::endpoint as coverart_endpoints; use coverart_caller::endpoint as coverart_endpoints;
use coverart_caller::response as coverart_responses; use coverart_caller::response as coverart_responses;
use coverart_queue_callers::endpoint as coverart_queue_endpoints;
use coverart_queue_callers::response as coverart_queue_responses;
use metadata_caller::endpoint as metadata_endpoints; use metadata_caller::endpoint as metadata_endpoints;
use metadata_caller::response as metadata_responses; use metadata_caller::response as metadata_responses;
use song_caller::endpoint as song_endpoints; use song_caller::endpoint as song_endpoints;
use song_caller::response as song_responses; use song_caller::response as song_responses;
use coverart_queue_callers::endpoint as coverart_queue_endpoints;
use coverart_queue_callers::response as coverart_queue_responses;
mod cors { mod cors {
pub async fn configure_cors() -> tower_http::cors::CorsLayer { pub async fn configure_cors() -> tower_http::cors::CorsLayer {
@@ -199,9 +199,10 @@ pub mod init {
) )
.route( .route(
crate::callers::endpoints::QUEUECOVERARTDATA, crate::callers::endpoints::QUEUECOVERARTDATA,
get(crate::callers::queue::coverart::endpoint::fetch_coverart_with_data).route_layer( get(crate::callers::queue::coverart::endpoint::fetch_coverart_with_data)
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::QUEUECOVERART, crate::callers::endpoints::QUEUECOVERART,