summaryrefslogtreecommitdiff
path: root/src/database/album.rs
diff options
context:
space:
mode:
authorniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2025-01-26 12:25:13 +0100
committerniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2025-01-26 12:25:13 +0100
commit5898e5ab4359945ef52dc7460bb2937a85603fc2 (patch)
tree0ef4c760bd6e30df2897e9cc725552ef54e51983 /src/database/album.rs
parente3f0f700bf2de3b8e7d7c72893a4d6cb128f000d (diff)
authentication done
Diffstat (limited to 'src/database/album.rs')
-rw-r--r--src/database/album.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/database/album.rs b/src/database/album.rs
index 87054f1..d7ffae0 100644
--- a/src/database/album.rs
+++ b/src/database/album.rs
@@ -114,18 +114,22 @@ impl DatabaseWrapper {
}
pub async fn edit_album(&self, data: AlbumPut) -> 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_album: Album = match self.select_album_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 album SET name=?, cover=? WHERE id=?",
- data.name.unwrap_or(og_album.name.unwrap_or(String::default())),
- data.cover.unwrap_or(og_album.cover.unwrap_or(String::default())),
+ data.name
+ .unwrap_or(og_album.name.unwrap_or(String::default())),
+ data.cover
+ .unwrap_or(og_album.cover.unwrap_or(String::default())),
data.id,
)
.execute(&self.db_pool)
@@ -149,5 +153,4 @@ impl DatabaseWrapper {
.execute(&self.db_pool)
.await
}
-
}