Files
negareh-api/src/modules/auth/dto/verify-otp.dto.ts
T
2026-02-25 16:58:36 +03:30

21 lines
625 B
TypeScript

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;
}