From 26bc889f8db3ba86efefb07d54b2e4ab343d3a23 Mon Sep 17 00:00:00 2001 From: Maarten Rijke Date: Tue, 5 Sep 2023 02:49:32 +0200 Subject: [PATCH] feat(server): include shared albums in getByAssetId (#3978) This commit changes the album.getByAssetId API to also consider albums that have been shared with the current user. This way when the user is browing their timeline and clicks to show the asset details they will see if the asset appears in not only their own albums but also albums shared with them. --- server/src/infra/repositories/album.repository.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/infra/repositories/album.repository.ts b/server/src/infra/repositories/album.repository.ts index c59589710b..d370936710 100644 --- a/server/src/infra/repositories/album.repository.ts +++ b/server/src/infra/repositories/album.repository.ts @@ -50,7 +50,10 @@ export class AlbumRepository implements IAlbumRepository { getByAssetId(ownerId: string, assetId: string): Promise { return this.repository.find({ - where: { ownerId, assets: { id: assetId } }, + where: [ + { ownerId, assets: { id: assetId } }, + { sharedUsers: { id: ownerId }, assets: { id: assetId } }, + ], relations: { owner: true, sharedUsers: true }, order: { createdAt: 'DESC' }, });