Files
negareh-api/src/modules/print/dto/create-field.dto.ts
T
2026-01-28 10:02:29 +03:30

33 lines
780 B
TypeScript

import { IsString, IsOptional, IsBoolean, IsInt, Min, IsEnum, IsNotEmpty } from 'class-validator';
import { ApiPropertyOptional, ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { FieldType } from '../interface/print';
export class CreateFieldDto {
@IsString()
@ApiProperty()
name: string;
@IsBoolean()
@Type(() => Boolean)
@ApiPropertyOptional({ example: true })
isRequired: boolean;
@IsBoolean()
@Type(() => Boolean)
@ApiPropertyOptional({ example: true })
multiple: boolean;
@IsNotEmpty()
@IsEnum(FieldType)
@ApiProperty({ enum: FieldType, example: FieldType.select })
type: FieldType;
@IsOptional()
@IsInt()
@Min(0)
@Type(() => Number)
@ApiPropertyOptional({ example: 1 })
order?: number;
}