mirror of https://github.com/immich-app/immich.git
fix(server): non-nullable `IsOptional` (#3939)
* custom `IsOptional` * added link to source * formatting * Update server/src/domain/domain.util.ts Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> * nullable birth date endpoint * made `nullable` a property * formatting * removed unused dto * updated decorator arg * fixed album e2e tests * add null tests for auth e2e * add null test for person e2e * fixed tests * added null test for user e2e * removed unusued import * log key in test name * chore: add note about mobile not being able to use the endpoint --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>pull/3948/head
parent
ca35e5557b
commit
9539a361e4
@ -1,12 +1,13 @@
|
|||||||
import { IsBoolean, IsOptional } from 'class-validator';
|
import { IsBoolean } from 'class-validator';
|
||||||
import { BulkIdsDto } from '../response-dto';
|
import { BulkIdsDto } from '../response-dto';
|
||||||
|
import { Optional } from '../../domain.util';
|
||||||
|
|
||||||
export class AssetBulkUpdateDto extends BulkIdsDto {
|
export class AssetBulkUpdateDto extends BulkIdsDto {
|
||||||
@IsOptional()
|
@Optional()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
isFavorite?: boolean;
|
isFavorite?: boolean;
|
||||||
|
|
||||||
@IsOptional()
|
@Optional()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
isArchived?: boolean;
|
isArchived?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,87 +1,87 @@
|
|||||||
import { AssetType } from '@app/infra/entities';
|
import { AssetType } from '@app/infra/entities';
|
||||||
import { Transform } from 'class-transformer';
|
import { Transform } from 'class-transformer';
|
||||||
import { IsArray, IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
import { IsArray, IsBoolean, IsEnum, IsNotEmpty, IsString } from 'class-validator';
|
||||||
import { toBoolean } from '../../domain.util';
|
import { toBoolean, Optional } from '../../domain.util';
|
||||||
|
|
||||||
export class SearchDto {
|
export class SearchDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
q?: string;
|
q?: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
query?: string;
|
query?: string;
|
||||||
|
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
@Transform(toBoolean)
|
@Transform(toBoolean)
|
||||||
clip?: boolean;
|
clip?: boolean;
|
||||||
|
|
||||||
@IsEnum(AssetType)
|
@IsEnum(AssetType)
|
||||||
@IsOptional()
|
@Optional()
|
||||||
type?: AssetType;
|
type?: AssetType;
|
||||||
|
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
@Transform(toBoolean)
|
@Transform(toBoolean)
|
||||||
isFavorite?: boolean;
|
isFavorite?: boolean;
|
||||||
|
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
@Transform(toBoolean)
|
@Transform(toBoolean)
|
||||||
isArchived?: boolean;
|
isArchived?: boolean;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
'exifInfo.city'?: string;
|
'exifInfo.city'?: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
'exifInfo.state'?: string;
|
'exifInfo.state'?: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
'exifInfo.country'?: string;
|
'exifInfo.country'?: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
'exifInfo.make'?: string;
|
'exifInfo.make'?: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
'exifInfo.model'?: string;
|
'exifInfo.model'?: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
'exifInfo.projectionType'?: string;
|
'exifInfo.projectionType'?: string;
|
||||||
|
|
||||||
@IsString({ each: true })
|
@IsString({ each: true })
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
@Transform(({ value }) => value.split(','))
|
@Transform(({ value }) => value.split(','))
|
||||||
'smartInfo.objects'?: string[];
|
'smartInfo.objects'?: string[];
|
||||||
|
|
||||||
@IsString({ each: true })
|
@IsString({ each: true })
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
@Transform(({ value }) => value.split(','))
|
@Transform(({ value }) => value.split(','))
|
||||||
'smartInfo.tags'?: string[];
|
'smartInfo.tags'?: string[];
|
||||||
|
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
@Transform(toBoolean)
|
@Transform(toBoolean)
|
||||||
recent?: boolean;
|
recent?: boolean;
|
||||||
|
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
@IsOptional()
|
@Optional()
|
||||||
@Transform(toBoolean)
|
@Transform(toBoolean)
|
||||||
motion?: boolean;
|
motion?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
import { IsNotEmpty, IsOptional } from 'class-validator';
|
|
||||||
|
|
||||||
export class CreateExifDto {
|
|
||||||
@IsNotEmpty()
|
|
||||||
assetId!: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
make?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
model?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
exifImageWidth?: number;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
exifImageHeight?: number;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
fileSizeInByte?: number;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
orientation?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
dateTimeOriginal?: Date;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
modifiedDate?: Date;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
lensModel?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
fNumber?: number;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
focalLenght?: number;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
iso?: number;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
exposureTime?: number;
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue