mirror of
https://github.com/immich-app/immich.git
synced 2026-02-13 12:27:56 +03:00
rename albumUserRepository in album service
This commit is contained in:
@@ -127,11 +127,11 @@ export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDt
|
||||
const sharedUsersV2: AlbumUserResponseDto[] = [];
|
||||
|
||||
if (entity.sharedUsers) {
|
||||
for (const permission of entity.sharedUsers) {
|
||||
sharedUsers.push(mapUser(permission.user));
|
||||
for (const albumUser of entity.sharedUsers) {
|
||||
sharedUsers.push(mapUser(albumUser.user));
|
||||
sharedUsersV2.push({
|
||||
user: mapUser(permission.user),
|
||||
role: permission.role,
|
||||
user: mapUser(albumUser.user),
|
||||
role: albumUser.role,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export class AlbumService {
|
||||
@Inject(IAlbumRepository) private albumRepository: IAlbumRepository,
|
||||
@Inject(IAssetRepository) private assetRepository: IAssetRepository,
|
||||
@Inject(IUserRepository) private userRepository: IUserRepository,
|
||||
@Inject(IAlbumUserRepository) private albumPermissionRepository: IAlbumUserRepository,
|
||||
@Inject(IAlbumUserRepository) private albumUserRepository: IAlbumUserRepository,
|
||||
) {
|
||||
this.access = AccessCore.create(accessRepository);
|
||||
}
|
||||
@@ -232,7 +232,7 @@ export class AlbumService {
|
||||
}
|
||||
|
||||
album.sharedUsers.push(
|
||||
await this.albumPermissionRepository.create({ user: { id: userId }, album: { id } } as AlbumUserEntity),
|
||||
await this.albumUserRepository.create({ user: { id: userId }, album: { id } } as AlbumUserEntity),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ export class AlbumService {
|
||||
await this.access.requirePermission(auth, Permission.ALBUM_SHARE, id);
|
||||
}
|
||||
|
||||
await this.albumPermissionRepository.delete({ albumId: id, userId });
|
||||
await this.albumUserRepository.delete({ albumId: id, userId });
|
||||
}
|
||||
|
||||
async updateAlbumUser(auth: AuthDto, id: string, userId: string, dto: Partial<AlbumUserEntity>): Promise<void> {
|
||||
@@ -273,7 +273,7 @@ export class AlbumService {
|
||||
throw new BadRequestException('Album not shared with user');
|
||||
}
|
||||
|
||||
await this.albumPermissionRepository.update({ albumId: id, userId }, { role: dto.role });
|
||||
await this.albumUserRepository.update({ albumId: id, userId }, { role: dto.role });
|
||||
}
|
||||
|
||||
private async findOrFail(id: string, options: AlbumInfoOptions) {
|
||||
|
||||
Reference in New Issue
Block a user