High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(server): remove albumThumbnailAssetId when album is empty (#495)
Thanh Pham0cf7606ec96b
diff --git a/server/apps/immich/src/api-v1/album/album-repository.ts b/server/apps/immich/src/api-v1/album/album-repository.tsindex 11ea08f7e9..7581620d28 100644--- a/server/apps/immich/src/api-v1/album/album-repository.ts+++ b/server/apps/immich/src/api-v1/album/album-repository.ts@@ -202,7 +202,14 @@ export class AlbumRepository implements IAlbumRepository {// TODO: No need to return boolean if using a singe delete queryif (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');}