This commit is contained in:
lychang
2026-07-20 00:50:45 +08:00
parent b1f0c2f36a
commit da412c1c76
7 changed files with 118 additions and 20 deletions

View File

@@ -98,6 +98,7 @@ impl Database {
// ── 写入 ──
pub async fn create_album(&self, album: CreateAlbum) -> Result<Uuid, sqlx::Error> {
let _guard = self.write_lock.lock().await;
let id = Uuid::new_v4();
let now = chrono::Utc::now().to_rfc3339();
sqlx::query(
@@ -108,6 +109,7 @@ impl Database {
}
pub async fn delete_album(&self, album_id: Uuid) -> Result<(), sqlx::Error> {
let _guard = self.write_lock.lock().await;
sqlx::query("DELETE FROM albums WHERE id = ?").bind(album_id.to_string()).execute(&self.pool).await?;
Ok(())
}