mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
refactor(server)!: add/remove album assets (#3109)
* refactor: add/remove album assets * chore: open api * feat: remove owned assets from album * refactor: move to bulk id req/res dto * chore: open api * chore: merge main * dev: mobile work * fix: adding asset from web not sync with mobile * remove print statement --------- Co-authored-by: Alex Tran <Alex.Tran@conductix.com>
This commit is contained in:
@@ -44,10 +44,9 @@
|
||||
const handleAddToAlbum = async (event: CustomEvent<{ album: AlbumResponseDto }>) => {
|
||||
showAlbumPicker = false;
|
||||
const album = event.detail.album;
|
||||
|
||||
const assetIds = Array.from(getAssets()).map((asset) => asset.id);
|
||||
|
||||
addAssetsToAlbum(album.id, assetIds).then(clearSelect);
|
||||
await addAssetsToAlbum(album.id, assetIds);
|
||||
clearSelect();
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -17,14 +17,20 @@
|
||||
|
||||
const removeFromAlbum = async () => {
|
||||
try {
|
||||
const { data } = await api.albumApi.removeAssetFromAlbum({
|
||||
const { data: results } = await api.albumApi.removeAssetFromAlbum({
|
||||
id: album.id,
|
||||
removeAssetsDto: {
|
||||
assetIds: Array.from(getAssets()).map((a) => a.id),
|
||||
},
|
||||
bulkIdsDto: { ids: Array.from(getAssets()).map((a) => a.id) },
|
||||
});
|
||||
|
||||
const { data } = await api.albumApi.getAlbumInfo({ id: album.id });
|
||||
album = data;
|
||||
|
||||
const count = results.filter(({ success }) => success).length;
|
||||
notificationController.show({
|
||||
type: NotificationType.Info,
|
||||
message: `Removed ${count} asset${count === 1 ? '' : 's'}`,
|
||||
});
|
||||
|
||||
clearSelect();
|
||||
} catch (e) {
|
||||
console.error('Error [album-viewer] [removeAssetFromAlbum]', e);
|
||||
|
||||
Reference in New Issue
Block a user