Files
dsc-api/src/modules/auth/DTO/verify-otp.dto.ts
T
2025-02-18 10:16:11 +03:30

19 lines
806 B
TypeScript

import { ApiProperty } from "@nestjs/swagger";
import { IsMobilePhone, IsNotEmpty, IsNumberString, Length } from "class-validator";
import { AuthMessage } from "../../../common/enums/message.enum";
export class VerifyOtpDto {
@IsNotEmpty({ message: AuthMessage.PHONE_NOT_EMPTY })
@Length(11, 11, { message: AuthMessage.PHONE_SHOULD_BE_11_DIGIT })
@IsMobilePhone("fa-IR", {}, { message: AuthMessage.INVALID_PHONE_FORMAT })
@ApiProperty({ description: "phone number", default: "09123456789" })
phone: string;
@ApiProperty({ description: "OTP code received via SMS", example: "56893" })
@IsNotEmpty({ message: AuthMessage.OTP_NOT_EMPTY })
@IsNumberString(undefined, { message: AuthMessage.OTP_FORMAT_INVALID })
@Length(5, 5, { message: AuthMessage.OTP_FORMAT_INVALID })
code: string;
}