mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
feat(web): show assets without thumbs (#2561)
* feat(web): show assets without thumbnails * chore: open api
This commit is contained in:
@@ -104,19 +104,23 @@ export class AssetRepository implements IAssetRepository {
|
||||
return this.getAssetCount(items);
|
||||
}
|
||||
|
||||
async getAssetByTimeBucket(userId: string, getAssetByTimeBucketDto: GetAssetByTimeBucketDto): Promise<AssetEntity[]> {
|
||||
async getAssetByTimeBucket(userId: string, dto: GetAssetByTimeBucketDto): Promise<AssetEntity[]> {
|
||||
// Get asset entity from a list of time buckets
|
||||
return await this.assetRepository
|
||||
let builder = this.assetRepository
|
||||
.createQueryBuilder('asset')
|
||||
.where('asset.ownerId = :userId', { userId: userId })
|
||||
.andWhere(`date_trunc('month', "fileCreatedAt") IN (:...buckets)`, {
|
||||
buckets: [...getAssetByTimeBucketDto.timeBucket],
|
||||
buckets: [...dto.timeBucket],
|
||||
})
|
||||
.andWhere('asset.resizePath is not NULL')
|
||||
.andWhere('asset.isVisible = true')
|
||||
.andWhere('asset.isArchived = false')
|
||||
.orderBy('asset.fileCreatedAt', 'DESC')
|
||||
.getMany();
|
||||
.orderBy('asset.fileCreatedAt', 'DESC');
|
||||
|
||||
if (!dto.withoutThumbs) {
|
||||
builder = builder.andWhere('asset.resizePath is not NULL');
|
||||
}
|
||||
|
||||
return builder.getMany();
|
||||
}
|
||||
|
||||
async getAssetCountByTimeBucket(userId: string, timeBucket: TimeGroupEnum) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNotEmpty, IsOptional, IsUUID } from 'class-validator';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsBoolean, IsNotEmpty, IsOptional, IsUUID } from 'class-validator';
|
||||
import { toBoolean } from '../../../utils/transform.util';
|
||||
|
||||
export class GetAssetByTimeBucketDto {
|
||||
@IsNotEmpty()
|
||||
@@ -15,4 +17,12 @@ export class GetAssetByTimeBucketDto {
|
||||
@IsUUID('4')
|
||||
@ApiProperty({ format: 'uuid' })
|
||||
userId?: string;
|
||||
|
||||
/**
|
||||
* Include assets without thumbnails
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
@Transform(toBoolean)
|
||||
withoutThumbs?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user