small optimizations

This commit is contained in:
mgabor
2024-04-23 08:48:50 +02:00
parent 858309c360
commit 90b0da282b
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -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,
}); });
} }
+1 -1
View File
@@ -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);