feat(server): improve validation in controllers (#2149)

* feat(server): improve validation in controllers

* set ValidationPipe config with decorator
This commit is contained in:
Michel Heusschen
2023-04-03 06:24:18 +02:00
committed by GitHub
parent ed551500e7
commit c584791b65
13 changed files with 54 additions and 24 deletions

View File

@@ -1,21 +1,30 @@
import { SystemConfig } from '@app/infra/entities';
import { ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
import { IsObject, ValidateNested } from 'class-validator';
import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto';
import { SystemConfigOAuthDto } from './system-config-oauth.dto';
import { SystemConfigPasswordLoginDto } from './system-config-password-login.dto';
import { SystemConfigStorageTemplateDto } from './system-config-storage-template.dto';
export class SystemConfigDto {
@Type(() => SystemConfigFFmpegDto)
@ValidateNested()
@IsObject()
ffmpeg!: SystemConfigFFmpegDto;
@Type(() => SystemConfigOAuthDto)
@ValidateNested()
@IsObject()
oauth!: SystemConfigOAuthDto;
@Type(() => SystemConfigPasswordLoginDto)
@ValidateNested()
@IsObject()
passwordLogin!: SystemConfigPasswordLoginDto;
@Type(() => SystemConfigStorageTemplateDto)
@ValidateNested()
@IsObject()
storageTemplate!: SystemConfigStorageTemplateDto;
}