diff options
Diffstat (limited to 'src/database')
-rw-r--r-- | src/database/artist.rs | 5 | ||||
-rw-r--r-- | src/database/search_results.rs | 15 | ||||
-rw-r--r-- | src/database/song.rs | 3 |
3 files changed, 6 insertions, 17 deletions
diff --git a/src/database/artist.rs b/src/database/artist.rs index 018bc17..5dda7a8 100644 --- a/src/database/artist.rs +++ b/src/database/artist.rs @@ -1,10 +1,13 @@ use crate::database::DatabaseWrapper; use serde::{Deserialize, Serialize}; use sqlx::mysql::MySqlQueryResult; +use utoipa::ToSchema; -#[derive(Serialize)] +#[derive(Serialize, ToSchema)] pub struct Artist { + #[schema(example = "Attempt", required = true)] name: Option<String>, + #[schema(example = 3, required = true)] id: Option<i32>, } diff --git a/src/database/search_results.rs b/src/database/search_results.rs index 1468111..027d160 100644 --- a/src/database/search_results.rs +++ b/src/database/search_results.rs @@ -4,21 +4,6 @@ use crate::database::artist::Artist; use crate::database::album::Album; impl DatabaseWrapper { - pub async fn search_results_by_id( - &self, - id: &str, - ) -> ( - Result<Option<Artist>, sqlx::Error>, - Result<Option<Album>, sqlx::Error>, - Result<Option<Song>, sqlx::Error>, - ) { - ( - self.select_artist_by_id(id).await, - self.select_album_by_id(id).await, - self.select_song_by_id(id).await, - ) - } - pub async fn search_results_by_name( &self, name: &str, diff --git a/src/database/song.rs b/src/database/song.rs index 2b45065..45c217b 100644 --- a/src/database/song.rs +++ b/src/database/song.rs @@ -1,8 +1,9 @@ use crate::database::DatabaseWrapper; use serde::{Deserialize, Serialize}; use sqlx::mysql::MySqlQueryResult; +use utoipa::ToSchema; -#[derive(Serialize)] +#[derive(Serialize, ToSchema)] pub struct Song { name: Option<String>, id: Option<i32>, |