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