refactor: api validators (boolean and date) (#7709)

* refactor: api validators (boolean and date)

* chore: open api

* revert: time bucket change
This commit is contained in:
Jason Rasmussen 2024-03-07 22:59:02 -05:00 committed by GitHub
parent 753842745d
commit a50f125dd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 276 additions and 368 deletions

View file

@ -1,7 +1,7 @@
import { LibraryEntity, LibraryType } from '@app/infra/entities';
import { ApiProperty } from '@nestjs/swagger';
import { ArrayMaxSize, ArrayUnique, IsBoolean, IsEnum, IsNotEmpty, IsString } from 'class-validator';
import { Optional, ValidateUUID } from '../domain.util';
import { ArrayMaxSize, ArrayUnique, IsEnum, IsNotEmpty, IsString } from 'class-validator';
import { Optional, ValidateBoolean, ValidateUUID } from '../domain.util';
export class CreateLibraryDto {
@IsEnum(LibraryType)
@ -16,8 +16,7 @@ export class CreateLibraryDto {
@IsNotEmpty()
name?: string;
@Optional()
@IsBoolean()
@ValidateBoolean({ optional: true })
isVisible?: boolean;
@Optional()
@ -34,8 +33,7 @@ export class CreateLibraryDto {
@ArrayMaxSize(128)
exclusionPatterns?: string[];
@Optional()
@IsBoolean()
@ValidateBoolean({ optional: true })
isWatched?: boolean;
}
@ -45,8 +43,7 @@ export class UpdateLibraryDto {
@IsNotEmpty()
name?: string;
@Optional()
@IsBoolean()
@ValidateBoolean({ optional: true })
isVisible?: boolean;
@Optional()
@ -102,13 +99,11 @@ export class LibrarySearchDto {
}
export class ScanLibraryDto {
@IsBoolean()
@Optional()
@ValidateBoolean({ optional: true })
refreshModifiedFiles?: boolean;
@IsBoolean()
@Optional()
refreshAllFiles?: boolean = false;
@ValidateBoolean({ optional: true })
refreshAllFiles?: boolean;
}
export class SearchLibraryDto {