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:
Alex
2023-02-27 18:28:45 -06:00
committed by GitHub
parent 243c98a02e
commit 25cff6a748
8 changed files with 27 additions and 16 deletions

View File

@@ -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;
}

View File

@@ -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];