mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-04 03:39:37 -05:00 
			
		
		
		
	fix(web) getting asset with avaialble thumbnail when getting asset count by time bucket (#900)
This commit is contained in:
		
							parent
							
								
									6fcc1d7685
								
							
						
					
					
						commit
						6e638cd673
					
				@ -35,7 +35,10 @@ export interface IAssetRepository {
 | 
				
			|||||||
  getAssetWithNoThumbnail(): Promise<AssetEntity[]>;
 | 
					  getAssetWithNoThumbnail(): Promise<AssetEntity[]>;
 | 
				
			||||||
  getAssetWithNoEXIF(): Promise<AssetEntity[]>;
 | 
					  getAssetWithNoEXIF(): Promise<AssetEntity[]>;
 | 
				
			||||||
  getAssetWithNoSmartInfo(): Promise<AssetEntity[]>;
 | 
					  getAssetWithNoSmartInfo(): Promise<AssetEntity[]>;
 | 
				
			||||||
  getExistingAssets(userId: string, checkDuplicateAssetDto: CheckExistingAssetsDto): Promise<CheckExistingAssetsResponseDto>;
 | 
					  getExistingAssets(
 | 
				
			||||||
 | 
					    userId: string,
 | 
				
			||||||
 | 
					    checkDuplicateAssetDto: CheckExistingAssetsDto,
 | 
				
			||||||
 | 
					  ): Promise<CheckExistingAssetsResponseDto>;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ASSET_REPOSITORY = 'ASSET_REPOSITORY';
 | 
					export const ASSET_REPOSITORY = 'ASSET_REPOSITORY';
 | 
				
			||||||
@ -118,6 +121,7 @@ export class AssetRepository implements IAssetRepository {
 | 
				
			|||||||
        .select(`COUNT(asset.id)::int`, 'count')
 | 
					        .select(`COUNT(asset.id)::int`, 'count')
 | 
				
			||||||
        .addSelect(`date_trunc('month', "createdAt")`, 'timeBucket')
 | 
					        .addSelect(`date_trunc('month', "createdAt")`, 'timeBucket')
 | 
				
			||||||
        .where('"userId" = :userId', { userId: userId })
 | 
					        .where('"userId" = :userId', { userId: userId })
 | 
				
			||||||
 | 
					        .andWhere('asset.resizePath is not NULL')
 | 
				
			||||||
        .groupBy(`date_trunc('month', "createdAt")`)
 | 
					        .groupBy(`date_trunc('month', "createdAt")`)
 | 
				
			||||||
        .orderBy(`date_trunc('month', "createdAt")`, 'DESC')
 | 
					        .orderBy(`date_trunc('month', "createdAt")`, 'DESC')
 | 
				
			||||||
        .getRawMany();
 | 
					        .getRawMany();
 | 
				
			||||||
@ -127,6 +131,7 @@ export class AssetRepository implements IAssetRepository {
 | 
				
			|||||||
        .select(`COUNT(asset.id)::int`, 'count')
 | 
					        .select(`COUNT(asset.id)::int`, 'count')
 | 
				
			||||||
        .addSelect(`date_trunc('day', "createdAt")`, 'timeBucket')
 | 
					        .addSelect(`date_trunc('day', "createdAt")`, 'timeBucket')
 | 
				
			||||||
        .where('"userId" = :userId', { userId: userId })
 | 
					        .where('"userId" = :userId', { userId: userId })
 | 
				
			||||||
 | 
					        .andWhere('asset.resizePath is not NULL')
 | 
				
			||||||
        .groupBy(`date_trunc('day', "createdAt")`)
 | 
					        .groupBy(`date_trunc('day', "createdAt")`)
 | 
				
			||||||
        .orderBy(`date_trunc('day', "createdAt")`, 'DESC')
 | 
					        .orderBy(`date_trunc('day', "createdAt")`, 'DESC')
 | 
				
			||||||
        .getRawMany();
 | 
					        .getRawMany();
 | 
				
			||||||
@ -284,7 +289,10 @@ export class AssetRepository implements IAssetRepository {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async getExistingAssets(userId: string, checkDuplicateAssetDto: CheckExistingAssetsDto): Promise<CheckExistingAssetsResponseDto> {
 | 
					  async getExistingAssets(
 | 
				
			||||||
 | 
					    userId: string,
 | 
				
			||||||
 | 
					    checkDuplicateAssetDto: CheckExistingAssetsDto,
 | 
				
			||||||
 | 
					  ): Promise<CheckExistingAssetsResponseDto> {
 | 
				
			||||||
    const existingAssets = await this.assetRepository.find({
 | 
					    const existingAssets = await this.assetRepository.find({
 | 
				
			||||||
      select: { deviceAssetId: true },
 | 
					      select: { deviceAssetId: true },
 | 
				
			||||||
      where: {
 | 
					      where: {
 | 
				
			||||||
@ -293,7 +301,6 @@ export class AssetRepository implements IAssetRepository {
 | 
				
			|||||||
        userId,
 | 
					        userId,
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    return new CheckExistingAssetsResponseDto(existingAssets.map(a => a.deviceAssetId));
 | 
					    return new CheckExistingAssetsResponseDto(existingAssets.map((a) => a.deviceAssetId));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user