summaryrefslogtreecommitdiff
path: root/src/database/artist.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/artist.rs')
-rw-r--r--src/database/artist.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/database/artist.rs b/src/database/artist.rs
index 5dda7a8..1d4e1cd 100644
--- a/src/database/artist.rs
+++ b/src/database/artist.rs
@@ -72,17 +72,20 @@ impl DatabaseWrapper {
}
pub async fn edit_artist(&self, data: ArtistPut) -> Result<MySqlQueryResult, sqlx::Error> {
- if data.id.is_none() { return Err(sqlx::Error::RowNotFound); }
+ if data.id.is_none() {
+ return Err(sqlx::Error::RowNotFound);
+ }
let og_artist: Artist = match self.select_artist_by_id(data.id.as_ref().unwrap()).await {
Ok(res) => match res.is_some() {
true => res.unwrap(),
false => return Err(sqlx::Error::RowNotFound),
- }
+ },
Err(_) => return Err(sqlx::Error::RowNotFound),
};
sqlx::query!(
"UPDATE artist SET name=? WHERE id=?",
- data.name.unwrap_or(og_artist.name.unwrap_or(String::default())),
+ data.name
+ .unwrap_or(og_artist.name.unwrap_or(String::default())),
data.id,
)
.execute(&self.db_pool)