mirror of
https://github.com/immich-app/immich.git
synced 2025-03-11 02:23:09 -05:00
fix(server): remove albumThumbnailAssetId when album is empty (#495)
This commit is contained in:
parent
25338ce02f
commit
0cf7606ec9
1 changed files with 8 additions and 1 deletions
|
@ -202,7 +202,14 @@ export class AlbumRepository implements IAlbumRepository {
|
|||
|
||||
// TODO: No need to return boolean if using a singe delete query
|
||||
if (deleteAssetCount == removeAssetsDto.assetIds.length) {
|
||||
return this.get(album.id) as Promise<AlbumEntity>;
|
||||
const retAlbum = await this.get(album.id) as AlbumEntity;
|
||||
|
||||
if (retAlbum?.assets?.length === 0) { // is empty album
|
||||
await this.albumRepository.update(album.id, { albumThumbnailAssetId: null });
|
||||
retAlbum.albumThumbnailAssetId = null;
|
||||
}
|
||||
|
||||
return retAlbum;
|
||||
} else {
|
||||
throw new BadRequestException('Some assets were not found in the album');
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue