mirror of
https://github.com/immich-app/immich.git
synced 2025-10-31 01:37:45 +09:00
feat(web): Add to Multiple Albums (#20072)
* Multi add to album picker: - update modal for multi select - Update add-to-album and add-to-album-action to work with new array return from AlbumPickerModal - Add asset-utils.addAssetsToAlbums (incomplete) * initial addToAlbums endpoint * - fix endpoint - add test * - update return type - make open-api * - simplify return dto - handle notification * - fix returns - clean up * - update i18n - format & check * - checks * - correct successId count - fix assets_cannot_be_added language call * tests * foromat * refactor * - update successful add message to included total attempted * - fix web test - format i18n * - fix open-api * - fix imports to resolve checks * - PR suggestions * open-api * refactor addAssetsToAlbums * refactor it again * - fix error returns and tests * - swap icon for IconButton - don't nest the buttons * open-api * - Cleanup multi-select button to match Thumbnail * merge and openapi * - remove onclick from icon element * - fix double onClose call with keyboard shortcuts * - spelling and formatting - apply new api permission * - open-api * chore: styling * translation --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -384,6 +384,16 @@ export type CreateAlbumDto = {
|
||||
assetIds?: string[];
|
||||
description?: string;
|
||||
};
|
||||
export type AlbumsAddAssetsDto = {
|
||||
albumIds: string[];
|
||||
assetIds: string[];
|
||||
};
|
||||
export type AlbumsAddAssetsResponseDto = {
|
||||
albumSuccessCount: number;
|
||||
assetSuccessCount: number;
|
||||
error?: BulkIdErrorReason;
|
||||
success: boolean;
|
||||
};
|
||||
export type AlbumStatisticsResponseDto = {
|
||||
notShared: number;
|
||||
owned: number;
|
||||
@@ -1864,6 +1874,26 @@ export function createAlbum({ createAlbumDto }: {
|
||||
body: createAlbumDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* This endpoint requires the `albumAsset.create` permission.
|
||||
*/
|
||||
export function addAssetsToAlbums({ key, slug, albumsAddAssetsDto }: {
|
||||
key?: string;
|
||||
slug?: string;
|
||||
albumsAddAssetsDto: AlbumsAddAssetsDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AlbumsAddAssetsResponseDto;
|
||||
}>(`/albums/assets${QS.query(QS.explode({
|
||||
key,
|
||||
slug
|
||||
}))}`, oazapfts.json({
|
||||
...opts,
|
||||
method: "PUT",
|
||||
body: albumsAddAssetsDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* This endpoint requires the `album.statistics` permission.
|
||||
*/
|
||||
@@ -4553,6 +4583,12 @@ export enum AssetTypeEnum {
|
||||
Audio = "AUDIO",
|
||||
Other = "OTHER"
|
||||
}
|
||||
export enum BulkIdErrorReason {
|
||||
Duplicate = "duplicate",
|
||||
NoPermission = "no_permission",
|
||||
NotFound = "not_found",
|
||||
Unknown = "unknown"
|
||||
}
|
||||
export enum Error {
|
||||
Duplicate = "duplicate",
|
||||
NoPermission = "no_permission",
|
||||
|
||||
Reference in New Issue
Block a user