mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
fix(server) long album load time on Album and Sharing page (#1890)
* chore: update package-lock.json version * rfix(server) long album load time * remove all eagerness * generate index * remove console.log * remove deadcode * fix: shared link album owner
This commit is contained in:
@@ -79,6 +79,7 @@ export class AlbumRepository implements IAlbumRepository {
|
||||
|
||||
const queryProperties: FindManyOptions<AlbumEntity> = {
|
||||
relations: { sharedUsers: true, assets: true, sharedLinks: true, owner: true },
|
||||
select: { assets: { id: true } },
|
||||
order: { assets: { fileCreatedAt: 'ASC' }, createdAt: 'ASC' },
|
||||
};
|
||||
|
||||
@@ -112,10 +113,6 @@ export class AlbumRepository implements IAlbumRepository {
|
||||
});
|
||||
}
|
||||
|
||||
const albums = await albumsQuery;
|
||||
|
||||
albums.sort((a, b) => new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf());
|
||||
|
||||
return albumsQuery;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,11 +66,11 @@ export class AlbumService {
|
||||
*/
|
||||
async getAllAlbums(authUser: AuthUserDto, getAlbumsDto: GetAlbumsDto): Promise<AlbumResponseDto[]> {
|
||||
let albums: AlbumEntity[];
|
||||
|
||||
if (typeof getAlbumsDto.assetId === 'string') {
|
||||
albums = await this.albumRepository.getListByAssetId(authUser.id, getAlbumsDto.assetId);
|
||||
} else {
|
||||
albums = await this.albumRepository.getList(authUser.id, getAlbumsDto);
|
||||
|
||||
if (getAlbumsDto.shared) {
|
||||
const publicSharingAlbums = await this.albumRepository.getPublicSharingList(authUser.id);
|
||||
albums = [...albums, ...publicSharingAlbums];
|
||||
|
||||
Reference in New Issue
Block a user