Browse Source

fix(server): avoid getting timebucket in the future (#4540)

Alex 1 year ago
parent
commit
cfec6a8fdb
1 changed files with 1 additions and 1 deletions
  1. 1 1
      server/src/infra/repositories/asset.repository.ts

+ 1 - 1
server/src/infra/repositories/asset.repository.ts

@@ -480,7 +480,6 @@ export class AssetRepository implements IAssetRepository {
 
 
   getTimeBuckets(options: TimeBucketOptions): Promise<TimeBucketItem[]> {
   getTimeBuckets(options: TimeBucketOptions): Promise<TimeBucketItem[]> {
     const truncated = dateTrunc(options);
     const truncated = dateTrunc(options);
-
     return this.getBuilder(options)
     return this.getBuilder(options)
       .select(`COUNT(asset.id)::int`, 'count')
       .select(`COUNT(asset.id)::int`, 'count')
       .addSelect(truncated, 'timeBucket')
       .addSelect(truncated, 'timeBucket')
@@ -508,6 +507,7 @@ export class AssetRepository implements IAssetRepository {
     let builder = this.repository
     let builder = this.repository
       .createQueryBuilder('asset')
       .createQueryBuilder('asset')
       .where('asset.isVisible = true')
       .where('asset.isVisible = true')
+      .andWhere('asset.fileCreatedAt < NOW()')
       .leftJoinAndSelect('asset.exifInfo', 'exifInfo');
       .leftJoinAndSelect('asset.exifInfo', 'exifInfo');
 
 
     if (albumId) {
     if (albumId) {