import { IsNotEmpty, IsString, Length, IsMobilePhone } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; import { normalizePhoneToLocal } from 'src/modules/util/phone.util'; export class VerifyOtpDto { @Transform(({ value }) => normalizePhoneToLocal(value)) @IsNotEmpty() @IsString() @ApiProperty({ example: '09362532122', description: 'Mobile number (accepts +98, 0098, 98, 09 formats)' }) @IsMobilePhone('fa-IR') phone: string; @IsNotEmpty() @IsString() @ApiProperty({ example: '', description: 'Otp' }) @Length(5) otp: string; }