mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 05:42:27 +00:00
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { IsEmail, IsString, Matches } from 'class-validator';
|
|
import { i18nValidationMessage as i18n } from 'nestjs-i18n';
|
|
import { COUNTRY_CODE_REGEX } from '~/auth/constants';
|
|
import { IsValidPhoneNumber } from '~/core/decorators/validations';
|
|
|
|
export class CreateCheckerRequestDto {
|
|
@ApiProperty({ example: 'checker@example.com' })
|
|
@ApiProperty({ example: 'test@test.com' })
|
|
@IsString({ message: i18n('validation.IsString', { path: 'general', property: 'auth.email' }) })
|
|
@IsEmail({}, { message: i18n('validation.IsEmail', { path: 'general', property: 'auth.email' }) })
|
|
email!: string;
|
|
|
|
@ApiProperty({ example: '+962' })
|
|
@Matches(COUNTRY_CODE_REGEX, {
|
|
message: i18n('validation.Matches', { path: 'general', property: 'auth.countryCode' }),
|
|
})
|
|
countryCode!: string;
|
|
|
|
@ApiProperty({ example: '797229134' })
|
|
@IsValidPhoneNumber({
|
|
message: i18n('validation.IsValidPhoneNumber', { path: 'general', property: 'auth.phoneNumber' }),
|
|
})
|
|
phoneNumber!: string;
|
|
}
|