import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { Transform, Type } from 'class-transformer'; import { IsDate, IsInt, IsNotEmpty, IsOptional, IsString } from 'class-validator'; export class CreateAddressDto { @ApiProperty() @IsNotEmpty() @IsString() street!: string; @ApiProperty() @IsNotEmpty() @IsString() city!: string; @ApiPropertyOptional() @IsOptional() @IsString() state?: string | null; @ApiProperty() @IsNotEmpty() @IsString() postalCode!: string; @ApiProperty() @IsNotEmpty() @IsString() country!: string; @ApiProperty() @IsNotEmpty() @IsInt() @Transform(({ value }) => parseInt(value, 10)) customerId!: number; @ApiPropertyOptional() @IsOptional() @IsDate() @Type(() => Date) createdAt?: Date; }