From 41d6293373d4269b238a4139489e7cf1321ba5ea Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Tue, 19 Aug 2025 19:05:51 -0400 Subject: [PATCH] tsk-170: Added documentation for song queue endpoint --- src/callers/song.rs | 16 +++++++++++++--- src/main.rs | 1 - 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/callers/song.rs b/src/callers/song.rs index c853eb0..ee6e119 100644 --- a/src/callers/song.rs +++ b/src/callers/song.rs @@ -104,7 +104,7 @@ pub mod request { pub mod response { use serde::{Deserialize, Serialize}; - #[derive(Default, Deserialize, Serialize)] + #[derive(Default, Deserialize, Serialize, utoipa::ToSchema)] pub struct Response { pub message: String, pub data: Vec, @@ -856,13 +856,23 @@ mod song_queue { pub mod endpoint { use axum::{Json, http::StatusCode, response::IntoResponse}; - use utoipa::OpenApi; - use utoipa_swagger_ui::SwaggerUi; use std::io::Write; use crate::callers::song::song_queue; + #[utoipa::path( + post, + path = "/song/queue", + request_body( + content = Object, + description = "Multipart form data for uploading song", + content_type = "multipart/form-data" + ), + responses( + (status = 200, description = "Song queued", body = super::response::Response) + ) + )] pub async fn queue_song( axum::Extension(pool): axum::Extension, mut multipart: axum::extract::Multipart, diff --git a/src/main.rs b/src/main.rs index dbdd9d1..ff1258a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,6 @@ pub mod auth; pub mod callers; - pub mod db { use sqlx::postgres::PgPoolOptions;