28 lines
659 B
TypeScript
28 lines
659 B
TypeScript
import { IsString, IsOptional, IsBoolean, IsInt, Min } from 'class-validator';
|
|
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
|
|
export class CreateCategoryDto {
|
|
@IsString()
|
|
@ApiPropertyOptional({ example: 'ایرانی' })
|
|
title!: string;
|
|
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
@Type(() => Boolean)
|
|
@ApiPropertyOptional({ example: true })
|
|
isActive?: boolean;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ example: 'https://cdn.example.com/avatar.png' })
|
|
avatarUrl?: string;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
@Type(() => Number)
|
|
@ApiPropertyOptional({ example: 1 })
|
|
order?: number;
|
|
}
|