mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(web): show assets without thumbs (#2561)
* feat(web): show assets without thumbnails * chore: open api
This commit is contained in:
parent
d827a6182b
commit
1613ae9185
10 changed files with 86 additions and 19 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue