add dto validation and swagger schemas
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, Matches } from 'class-validator';
|
||||
|
||||
export class RequestOtpDto {
|
||||
@ApiProperty({ example: '09122222222' })
|
||||
@IsString()
|
||||
@Matches(/^(\+?\d{10,15}|09\d{9})$/, {
|
||||
message: 'mobile must be a valid mobile number',
|
||||
})
|
||||
mobile!: string;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, Matches } from 'class-validator';
|
||||
|
||||
export class VerifyOtpDto {
|
||||
@ApiProperty({ example: '09122222222' })
|
||||
@IsString()
|
||||
@Matches(/^(\+?\d{10,15}|09\d{9})$/, {
|
||||
message: 'mobile must be a valid mobile number',
|
||||
})
|
||||
mobile!: string;
|
||||
|
||||
@ApiProperty({ example: '123456' })
|
||||
@IsString()
|
||||
@Matches(/^\d{4,8}$/, {
|
||||
message: 'code must be 4 to 8 digits',
|
||||
})
|
||||
code!: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user