small optimizations
This commit is contained in:
@@ -128,9 +128,10 @@ export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDt
|
|||||||
|
|
||||||
if (entity.albumUsers) {
|
if (entity.albumUsers) {
|
||||||
for (const albumUser of entity.albumUsers) {
|
for (const albumUser of entity.albumUsers) {
|
||||||
sharedUsers.push(mapUser(albumUser.user));
|
const user = mapUser(albumUser.user);
|
||||||
|
sharedUsers.push(user);
|
||||||
albumUsers.push({
|
albumUsers.push({
|
||||||
user: mapUser(albumUser.user),
|
user,
|
||||||
role: albumUser.role,
|
role: albumUser.role,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ export class AlbumService {
|
|||||||
throw new BadRequestException('User not found');
|
throw new BadRequestException('User not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
album.albumUsers.push(await this.albumUserRepository.create({ userId: userId, albumId: id }));
|
await this.albumUserRepository.create({ userId: userId, albumId: id });
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.findOrFail(id, { withAssets: true }).then(mapAlbumWithoutAssets);
|
return this.findOrFail(id, { withAssets: true }).then(mapAlbumWithoutAssets);
|
||||||
|
|||||||
Reference in New Issue
Block a user