mirror of
https://github.com/KevinMidboe/immich.git
synced 2026-02-11 02:39:22 +00:00
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>
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import { AssetType } from '@app/infra/entities';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsBoolean, IsOptional } from 'class-validator';
|
||||
import { toBoolean } from '../../domain.util';
|
||||
import { IsBoolean } from 'class-validator';
|
||||
import { toBoolean, Optional } from '../../domain.util';
|
||||
import { AssetStats } from '../asset.repository';
|
||||
|
||||
export class AssetStatsDto {
|
||||
@IsBoolean()
|
||||
@Transform(toBoolean)
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
isArchived?: boolean;
|
||||
|
||||
@IsBoolean()
|
||||
@Transform(toBoolean)
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
isFavorite?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { IsBoolean, IsOptional } from 'class-validator';
|
||||
import { IsBoolean } from 'class-validator';
|
||||
import { BulkIdsDto } from '../response-dto';
|
||||
import { Optional } from '../../domain.util';
|
||||
|
||||
export class AssetBulkUpdateDto extends BulkIdsDto {
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
@IsBoolean()
|
||||
isFavorite?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
@IsBoolean()
|
||||
isArchived?: boolean;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsInt, IsOptional, IsPositive } from 'class-validator';
|
||||
import { ValidateUUID } from '../../domain.util';
|
||||
import { IsInt, IsPositive } from 'class-validator';
|
||||
import { Optional, ValidateUUID } from '../../domain.util';
|
||||
|
||||
export class DownloadInfoDto {
|
||||
@ValidateUUID({ each: true, optional: true })
|
||||
@@ -14,7 +14,7 @@ export class DownloadInfoDto {
|
||||
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
@ApiProperty({ type: 'integer' })
|
||||
archiveSize?: number;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsBoolean, IsDate, IsOptional } from 'class-validator';
|
||||
import { toBoolean } from '../../domain.util';
|
||||
import { IsBoolean, IsDate } from 'class-validator';
|
||||
import { toBoolean, Optional } from '../../domain.util';
|
||||
|
||||
export class MapMarkerDto {
|
||||
@ApiProperty()
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
@IsBoolean()
|
||||
@Transform(toBoolean)
|
||||
isFavorite?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
fileCreatedAfter?: Date;
|
||||
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
fileCreatedBefore?: Date;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||
import { toBoolean, ValidateUUID } from '../../domain.util';
|
||||
import { IsBoolean, IsEnum, IsNotEmpty, IsString } from 'class-validator';
|
||||
import { toBoolean, ValidateUUID, Optional } from '../../domain.util';
|
||||
import { TimeBucketSize } from '../asset.repository';
|
||||
|
||||
export class TimeBucketDto {
|
||||
@@ -19,12 +19,12 @@ export class TimeBucketDto {
|
||||
@ValidateUUID({ optional: true })
|
||||
personId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
@IsBoolean()
|
||||
@Transform(toBoolean)
|
||||
isArchived?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@Optional()
|
||||
@IsBoolean()
|
||||
@Transform(toBoolean)
|
||||
isFavorite?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user