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.
This commit is contained in:
Maarten Rijke 2023-09-05 02:49:32 +02:00 committed by GitHub
parent 54775b896f
commit 26bc889f8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,7 +50,10 @@ export class AlbumRepository implements IAlbumRepository {
getByAssetId(ownerId: string, assetId: string): Promise<AlbumEntity[]> {
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' },
});