2023-03-30 21:38:55 +02:00
|
|
|
import { AssetType } from '@app/infra/entities';
|
2023-03-03 03:47:08 +01:00
|
|
|
import { Transform } from 'class-transformer';
|
2023-09-01 18:40:00 +02:00
|
|
|
import { IsArray, IsBoolean, IsEnum, IsNotEmpty, IsString } from 'class-validator';
|
2023-09-04 21:45:59 +02:00
|
|
|
import { Optional, toBoolean } from '../../domain.util';
|
2023-03-03 03:47:08 +01:00
|
|
|
|
|
|
|
export class SearchDto {
|
2023-03-18 14:44:42 +01:00
|
|
|
@IsString()
|
|
|
|
@IsNotEmpty()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-18 14:44:42 +01:00
|
|
|
q?: string;
|
|
|
|
|
2023-03-03 03:47:08 +01:00
|
|
|
@IsString()
|
|
|
|
@IsNotEmpty()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
query?: string;
|
|
|
|
|
2023-03-18 14:44:42 +01:00
|
|
|
@IsBoolean()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-18 14:44:42 +01:00
|
|
|
@Transform(toBoolean)
|
|
|
|
clip?: boolean;
|
|
|
|
|
2023-03-03 03:47:08 +01:00
|
|
|
@IsEnum(AssetType)
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
type?: AssetType;
|
|
|
|
|
|
|
|
@IsBoolean()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
@Transform(toBoolean)
|
|
|
|
isFavorite?: boolean;
|
|
|
|
|
2023-04-12 17:37:52 +02:00
|
|
|
@IsBoolean()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-04-12 17:37:52 +02:00
|
|
|
@Transform(toBoolean)
|
|
|
|
isArchived?: boolean;
|
|
|
|
|
2023-03-03 03:47:08 +01:00
|
|
|
@IsString()
|
|
|
|
@IsNotEmpty()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
'exifInfo.city'?: string;
|
|
|
|
|
|
|
|
@IsString()
|
|
|
|
@IsNotEmpty()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
'exifInfo.state'?: string;
|
|
|
|
|
|
|
|
@IsString()
|
|
|
|
@IsNotEmpty()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
'exifInfo.country'?: string;
|
|
|
|
|
|
|
|
@IsString()
|
|
|
|
@IsNotEmpty()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
'exifInfo.make'?: string;
|
|
|
|
|
|
|
|
@IsString()
|
|
|
|
@IsNotEmpty()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
'exifInfo.model'?: string;
|
|
|
|
|
2023-07-31 03:31:57 +02:00
|
|
|
@IsString()
|
|
|
|
@IsNotEmpty()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-07-31 03:31:57 +02:00
|
|
|
'exifInfo.projectionType'?: string;
|
|
|
|
|
2023-03-03 03:47:08 +01:00
|
|
|
@IsString({ each: true })
|
|
|
|
@IsArray()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
@Transform(({ value }) => value.split(','))
|
|
|
|
'smartInfo.objects'?: string[];
|
|
|
|
|
|
|
|
@IsString({ each: true })
|
|
|
|
@IsArray()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-03 03:47:08 +01:00
|
|
|
@Transform(({ value }) => value.split(','))
|
|
|
|
'smartInfo.tags'?: string[];
|
2023-03-05 21:44:31 +01:00
|
|
|
|
|
|
|
@IsBoolean()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-05 21:44:31 +01:00
|
|
|
@Transform(toBoolean)
|
|
|
|
recent?: boolean;
|
|
|
|
|
|
|
|
@IsBoolean()
|
2023-09-01 18:40:00 +02:00
|
|
|
@Optional()
|
2023-03-05 21:44:31 +01:00
|
|
|
@Transform(toBoolean)
|
|
|
|
motion?: boolean;
|
2023-03-03 03:47:08 +01:00
|
|
|
}
|
2023-10-10 16:34:25 +02:00
|
|
|
|
|
|
|
export class SearchPeopleDto {
|
|
|
|
@IsString()
|
|
|
|
@IsNotEmpty()
|
|
|
|
name!: string;
|
|
|
|
}
|