diff options
Diffstat (limited to 'src/routes/artist.rs')
-rw-r--r-- | src/routes/artist.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/routes/artist.rs b/src/routes/artist.rs index 5f0b9a6..18272fb 100644 --- a/src/routes/artist.rs +++ b/src/routes/artist.rs @@ -16,12 +16,12 @@ pub async fn artist( ) -> HttpResponse { let default: String = String::from(""); let search_attempt: sqlx::Result<Vec<Artist>, sqlx::Error> = match true { - _ if check_if_exists(&get_args.id) => { + _ if get_args.id.is_some() => { let id: &str = &get_args.id.as_ref().unwrap_or(&default); app_state.database.select_artist_by_id(id).await } - _ if check_if_exists(&get_args.name) => { + _ if get_args.name.is_some() => { let name: &str = &get_args.name.as_ref().unwrap_or(&default); app_state.database.select_artists_by_name(name).await } @@ -33,10 +33,3 @@ pub async fn artist( Err(e) => HttpResponse::Ok().body(format!("{}", e)), } } - -fn check_if_exists(value: &Option<String>) -> bool { - match value { - Some(_) => true, - None => false, - } -} |