mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 16:41:59 +00:00
Rename repository method
This commit is contained in:
parent
33b7d1fc06
commit
c8d4ed3619
3 changed files with 4 additions and 4 deletions
|
@ -25,7 +25,7 @@ export interface IAlbumRepository {
|
||||||
updateAlbum(album: AlbumEntity, updateAlbumDto: UpdateAlbumDto): Promise<AlbumEntity>;
|
updateAlbum(album: AlbumEntity, updateAlbumDto: UpdateAlbumDto): Promise<AlbumEntity>;
|
||||||
getListByAssetId(userId: string, assetId: string): Promise<AlbumEntity[]>;
|
getListByAssetId(userId: string, assetId: string): Promise<AlbumEntity[]>;
|
||||||
getCountByUserId(userId: string): Promise<AlbumCountResponseDto>;
|
getCountByUserId(userId: string): Promise<AlbumCountResponseDto>;
|
||||||
getSharedAlbumCount(userId: string, assetId: string): Promise<number>;
|
getSharedWithUserAlbumCount(userId: string, assetId: string): Promise<number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ALBUM_REPOSITORY = 'ALBUM_REPOSITORY';
|
export const ALBUM_REPOSITORY = 'ALBUM_REPOSITORY';
|
||||||
|
@ -285,7 +285,7 @@ export class AlbumRepository implements IAlbumRepository {
|
||||||
return this.albumRepository.save(album);
|
return this.albumRepository.save(album);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSharedAlbumCount(userId: string, assetId: string): Promise<number> {
|
async getSharedWithUserAlbumCount(userId: string, assetId: string): Promise<number> {
|
||||||
const result = await this
|
const result = await this
|
||||||
.userAlbumRepository
|
.userAlbumRepository
|
||||||
.createQueryBuilder('usa')
|
.createQueryBuilder('usa')
|
||||||
|
|
|
@ -123,7 +123,7 @@ describe('Album service', () => {
|
||||||
updateAlbum: jest.fn(),
|
updateAlbum: jest.fn(),
|
||||||
getListByAssetId: jest.fn(),
|
getListByAssetId: jest.fn(),
|
||||||
getCountByUserId: jest.fn(),
|
getCountByUserId: jest.fn(),
|
||||||
getSharedAlbumCount: jest.fn(),
|
getSharedWithUserAlbumCount: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
assetRepositoryMock = {
|
assetRepositoryMock = {
|
||||||
|
|
|
@ -641,7 +641,7 @@ export class AssetService {
|
||||||
// Avoid additional checks if ownership is required
|
// Avoid additional checks if ownership is required
|
||||||
if (!mustBeOwner) {
|
if (!mustBeOwner) {
|
||||||
// Step 2: Check if asset is part of an album shared with me
|
// 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue