mirror of
https://github.com/immich-app/immich.git
synced 2025-02-04 01:09:14 -05:00
fix: use fileCreatedAt for asset sorting after recent refactor (#1799)
This commit is contained in:
parent
d1ea6a897e
commit
824409351e
1 changed files with 8 additions and 8 deletions
|
@ -152,12 +152,12 @@ export class AssetRepository implements IAssetRepository {
|
||||||
return await this.assetRepository
|
return await this.assetRepository
|
||||||
.createQueryBuilder('asset')
|
.createQueryBuilder('asset')
|
||||||
.where('asset.ownerId = :userId', { userId: userId })
|
.where('asset.ownerId = :userId', { userId: userId })
|
||||||
.andWhere(`date_trunc('month', "createdAt") IN (:...buckets)`, {
|
.andWhere(`date_trunc('month', "fileCreatedAt") IN (:...buckets)`, {
|
||||||
buckets: [...getAssetByTimeBucketDto.timeBucket],
|
buckets: [...getAssetByTimeBucketDto.timeBucket],
|
||||||
})
|
})
|
||||||
.andWhere('asset.resizePath is not NULL')
|
.andWhere('asset.resizePath is not NULL')
|
||||||
.andWhere('asset.isVisible = true')
|
.andWhere('asset.isVisible = true')
|
||||||
.orderBy('asset.createdAt', 'DESC')
|
.orderBy('asset.fileCreatedAt', 'DESC')
|
||||||
.getMany();
|
.getMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,23 +168,23 @@ export class AssetRepository implements IAssetRepository {
|
||||||
result = await this.assetRepository
|
result = await this.assetRepository
|
||||||
.createQueryBuilder('asset')
|
.createQueryBuilder('asset')
|
||||||
.select(`COUNT(asset.id)::int`, 'count')
|
.select(`COUNT(asset.id)::int`, 'count')
|
||||||
.addSelect(`date_trunc('month', "createdAt")`, 'timeBucket')
|
.addSelect(`date_trunc('month', "fileCreatedAt")`, 'timeBucket')
|
||||||
.where('"ownerId" = :userId', { userId: userId })
|
.where('"ownerId" = :userId', { userId: userId })
|
||||||
.andWhere('asset.resizePath is not NULL')
|
.andWhere('asset.resizePath is not NULL')
|
||||||
.andWhere('asset.isVisible = true')
|
.andWhere('asset.isVisible = true')
|
||||||
.groupBy(`date_trunc('month', "createdAt")`)
|
.groupBy(`date_trunc('month', "fileCreatedAt")`)
|
||||||
.orderBy(`date_trunc('month', "createdAt")`, 'DESC')
|
.orderBy(`date_trunc('month', "fileCreatedAt")`, 'DESC')
|
||||||
.getRawMany();
|
.getRawMany();
|
||||||
} else if (timeBucket === TimeGroupEnum.Day) {
|
} else if (timeBucket === TimeGroupEnum.Day) {
|
||||||
result = await this.assetRepository
|
result = await this.assetRepository
|
||||||
.createQueryBuilder('asset')
|
.createQueryBuilder('asset')
|
||||||
.select(`COUNT(asset.id)::int`, 'count')
|
.select(`COUNT(asset.id)::int`, 'count')
|
||||||
.addSelect(`date_trunc('day', "createdAt")`, 'timeBucket')
|
.addSelect(`date_trunc('day', "fileCreatedAt")`, 'timeBucket')
|
||||||
.where('"ownerId" = :userId', { userId: userId })
|
.where('"ownerId" = :userId', { userId: userId })
|
||||||
.andWhere('asset.resizePath is not NULL')
|
.andWhere('asset.resizePath is not NULL')
|
||||||
.andWhere('asset.isVisible = true')
|
.andWhere('asset.isVisible = true')
|
||||||
.groupBy(`date_trunc('day', "createdAt")`)
|
.groupBy(`date_trunc('day', "fileCreatedAt")`)
|
||||||
.orderBy(`date_trunc('day', "createdAt")`, 'DESC')
|
.orderBy(`date_trunc('day', "fileCreatedAt")`, 'DESC')
|
||||||
.getRawMany();
|
.getRawMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue