feat: add functionality to remove media from album, including API integration and UI context menu
This commit is contained in:
@@ -183,4 +183,24 @@ impl AlbumRepository for PostgresAlbumRepository {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn remove_media_from_album(&self, album_id: Uuid, media_ids: &[Uuid]) -> CoreResult<()> {
|
||||
if media_ids.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
sqlx::query!(
|
||||
r#"
|
||||
DELETE FROM album_media
|
||||
WHERE album_id = $1 AND media_id = ANY($2)
|
||||
"#,
|
||||
album_id,
|
||||
media_ids
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| CoreError::Database(e.to_string()))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user