Skip to content

Commit

Permalink
fix: album performances (#5224)
Browse files Browse the repository at this point in the history
* fix: album performances

* fix: tests
  • Loading branch information
martabal authored Nov 21, 2023
1 parent c46e825 commit c438e17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/src/domain/album/album.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export class AlbumService {
async get(authUser: AuthUserDto, id: string, dto: AlbumInfoDto): Promise<AlbumResponseDto> {
await this.access.requirePermission(authUser, Permission.ALBUM_READ, id);
await this.albumRepository.updateThumbnails();
return mapAlbum(await this.findOrFail(id, { withAssets: true }), !dto.withoutAssets);
const withAssets = dto.withoutAssets === undefined ? true : !dto.withoutAssets;
return mapAlbum(await this.findOrFail(id, { withAssets }), !dto.withoutAssets);
}

async create(authUser: AuthUserDto, dto: CreateAlbumDto): Promise<AlbumResponseDto> {
Expand Down
4 changes: 4 additions & 0 deletions server/src/infra/repositories/album.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class AlbumRepository implements IAlbumRepository {
],
relations: { owner: true, sharedUsers: true },
order: { createdAt: 'DESC' },
relationLoadStrategy: 'query',
});
}

Expand Down Expand Up @@ -91,6 +92,7 @@ export class AlbumRepository implements IAlbumRepository {
relations: { sharedUsers: true, sharedLinks: true, owner: true },
where: { ownerId },
order: { createdAt: 'DESC' },
relationLoadStrategy: 'query',
});
}

Expand All @@ -106,6 +108,7 @@ export class AlbumRepository implements IAlbumRepository {
{ ownerId, sharedUsers: { id: Not(IsNull()) } },
],
order: { createdAt: 'DESC' },
relationLoadStrategy: 'query',
});
}

Expand All @@ -117,6 +120,7 @@ export class AlbumRepository implements IAlbumRepository {
relations: { sharedUsers: true, sharedLinks: true, owner: true },
where: { ownerId, sharedUsers: { id: IsNull() }, sharedLinks: { id: IsNull() } },
order: { createdAt: 'DESC' },
relationLoadStrategy: 'query',
});
}

Expand Down

0 comments on commit c438e17

Please sign in to comment.