From c8d4ed3619a130bfb36e76d8c0f0976359ef49e4 Mon Sep 17 00:00:00 2001 From: Matthias Rupp Date: Thu, 1 Dec 2022 17:05:59 +0100 Subject: [PATCH] Rename repository method --- server/apps/immich/src/api-v1/album/album-repository.ts | 4 ++-- server/apps/immich/src/api-v1/album/album.service.spec.ts | 2 +- server/apps/immich/src/api-v1/asset/asset.service.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/apps/immich/src/api-v1/album/album-repository.ts b/server/apps/immich/src/api-v1/album/album-repository.ts index cef78e0b2f..569b7b4295 100644 --- a/server/apps/immich/src/api-v1/album/album-repository.ts +++ b/server/apps/immich/src/api-v1/album/album-repository.ts @@ -25,7 +25,7 @@ export interface IAlbumRepository { updateAlbum(album: AlbumEntity, updateAlbumDto: UpdateAlbumDto): Promise; getListByAssetId(userId: string, assetId: string): Promise; getCountByUserId(userId: string): Promise; - getSharedAlbumCount(userId: string, assetId: string): Promise; + getSharedWithUserAlbumCount(userId: string, assetId: string): Promise; } export const ALBUM_REPOSITORY = 'ALBUM_REPOSITORY'; @@ -285,7 +285,7 @@ export class AlbumRepository implements IAlbumRepository { return this.albumRepository.save(album); } - async getSharedAlbumCount(userId: string, assetId: string): Promise { + async getSharedWithUserAlbumCount(userId: string, assetId: string): Promise { const result = await this .userAlbumRepository .createQueryBuilder('usa') diff --git a/server/apps/immich/src/api-v1/album/album.service.spec.ts b/server/apps/immich/src/api-v1/album/album.service.spec.ts index adfcff13fd..ca1db8f62e 100644 --- a/server/apps/immich/src/api-v1/album/album.service.spec.ts +++ b/server/apps/immich/src/api-v1/album/album.service.spec.ts @@ -123,7 +123,7 @@ describe('Album service', () => { updateAlbum: jest.fn(), getListByAssetId: jest.fn(), getCountByUserId: jest.fn(), - getSharedAlbumCount: jest.fn(), + getSharedWithUserAlbumCount: jest.fn(), }; assetRepositoryMock = { diff --git a/server/apps/immich/src/api-v1/asset/asset.service.ts b/server/apps/immich/src/api-v1/asset/asset.service.ts index 7d8d5dde28..fb5dc20fdb 100644 --- a/server/apps/immich/src/api-v1/asset/asset.service.ts +++ b/server/apps/immich/src/api-v1/asset/asset.service.ts @@ -641,7 +641,7 @@ export class AssetService { // Avoid additional checks if ownership is required if (!mustBeOwner) { // Step 2: Check if asset is part of an album shared with me - if ((await this._albumRepository.getSharedAlbumCount(authUser.id, assetId)) > 0) { + if ((await this._albumRepository.getSharedWithUserAlbumCount(authUser.id, assetId)) > 0) { continue; }