From c438e179543fe4f079dfa4ec15a227ad89b359ae Mon Sep 17 00:00:00 2001 From: martin <74269598+martabal@users.noreply.github.com> Date: Tue, 21 Nov 2023 15:49:53 +0100 Subject: [PATCH] fix: album performances (#5224) * fix: album performances * fix: tests --- server/src/domain/album/album.service.ts | 3 ++- server/src/infra/repositories/album.repository.ts | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/domain/album/album.service.ts b/server/src/domain/album/album.service.ts index 8a66aaa33d..9033bcd1c6 100644 --- a/server/src/domain/album/album.service.ts +++ b/server/src/domain/album/album.service.ts @@ -81,7 +81,8 @@ export class AlbumService { async get(authUser: AuthUserDto, id: string, dto: AlbumInfoDto): Promise { await this.access.requirePermission(authUser, Permission.ALBUM_READ, id); await this.albumRepository.updateThumbnails(); - return mapAlbum(await this.findOrFail(id, { withAssets: true }), !dto.withoutAssets); + const withAssets = dto.withoutAssets === undefined ? true : !dto.withoutAssets; + return mapAlbum(await this.findOrFail(id, { withAssets }), !dto.withoutAssets); } async create(authUser: AuthUserDto, dto: CreateAlbumDto): Promise { diff --git a/server/src/infra/repositories/album.repository.ts b/server/src/infra/repositories/album.repository.ts index 735b2d5849..c71ce1c38a 100644 --- a/server/src/infra/repositories/album.repository.ts +++ b/server/src/infra/repositories/album.repository.ts @@ -56,6 +56,7 @@ export class AlbumRepository implements IAlbumRepository { ], relations: { owner: true, sharedUsers: true }, order: { createdAt: 'DESC' }, + relationLoadStrategy: 'query', }); } @@ -91,6 +92,7 @@ export class AlbumRepository implements IAlbumRepository { relations: { sharedUsers: true, sharedLinks: true, owner: true }, where: { ownerId }, order: { createdAt: 'DESC' }, + relationLoadStrategy: 'query', }); } @@ -106,6 +108,7 @@ export class AlbumRepository implements IAlbumRepository { { ownerId, sharedUsers: { id: Not(IsNull()) } }, ], order: { createdAt: 'DESC' }, + relationLoadStrategy: 'query', }); } @@ -117,6 +120,7 @@ export class AlbumRepository implements IAlbumRepository { relations: { sharedUsers: true, sharedLinks: true, owner: true }, where: { ownerId, sharedUsers: { id: IsNull() }, sharedLinks: { id: IsNull() } }, order: { createdAt: 'DESC' }, + relationLoadStrategy: 'query', }); }