Files
api/src/program-settings/dto/import-program-settings.dto.ts
T

36 lines
747 B
TypeScript
Raw Normal View History

import { Allow, IsArray, IsIn, IsOptional, IsString, MaxLength, MinLength, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
export class ImportDecisionDto {
@IsString()
@MinLength(1)
@MaxLength(50)
key!: string;
@IsIn(['none', 'this', 'all'])
scope!: 'none' | 'this' | 'all';
}
export class ImportProgramSettingsDto {
@IsString()
@MinLength(3)
@MaxLength(32)
mobile!: string;
@IsString()
@MinLength(1)
@MaxLength(120)
password!: string;
@IsOptional()
@IsArray()
@ValidateNested({ each: true })
@Type(() => ImportDecisionDto)
decisions?: ImportDecisionDto[];
/** اگر true فقط پیش‌نمایش برگردد */
@IsOptional()
@Allow()
preview?: boolean;
}