mirror of
https://github.com/immich-app/immich.git
synced 2025-01-12 15:32:36 +02:00
fix(server): remove albumThumbnailAssetId when album is empty (#495)
This commit is contained in:
parent
25338ce02f
commit
0cf7606ec9
@ -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…
Reference in New Issue
Block a user