add dto validation and swagger schemas

This commit is contained in:
2026-05-12 16:17:39 +03:30
parent abb387e743
commit 460537090b
21 changed files with 510 additions and 0 deletions
+8
View File
@@ -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;
}
+14
View File
@@ -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;
}