import { ApiPropertyOptional } from '@nestjs/swagger'; import { Transform, Type } from 'class-transformer'; import { IsDate, IsInt, IsNumber, IsOptional } from 'class-validator'; export class UpdateOrderItemDto { @ApiPropertyOptional() @IsOptional() @IsInt() @Transform(({ value }) => value !== undefined ? parseInt(value, 10) : undefined) id?: number; @ApiPropertyOptional() @IsOptional() @IsInt() @Transform(({ value }) => value !== undefined ? parseInt(value, 10) : undefined) quantity?: number; @ApiPropertyOptional() @IsOptional() @IsNumber() @Transform(({ value }) => value !== undefined ? parseFloat(value) : undefined) price?: number; @ApiPropertyOptional() @IsOptional() @IsInt() @Transform(({ value }) => value !== undefined ? parseInt(value, 10) : undefined) orderId?: number; @ApiPropertyOptional() @IsOptional() @IsInt() @Transform(({ value }) => value !== undefined ? parseInt(value, 10) : undefined) productId?: number; @ApiPropertyOptional() @IsOptional() @IsDate() @Type(() => Date) createdAt?: Date; }