feat: add country iso enum

This commit is contained in:
Abdalhamid Alhamad
2025-05-26 12:10:09 +03:00
parent 49326e983f
commit 42e4d75d70
7 changed files with 527 additions and 7 deletions
@@ -1,6 +1,16 @@
import { ApiProperty, PickType } from '@nestjs/swagger';
import { IsDateString, IsNotEmpty, IsNumberString, IsOptional, IsString, MaxLength, MinLength } from 'class-validator';
import {
IsDateString,
IsEnum,
IsNotEmpty,
IsNumberString,
IsOptional,
IsString,
MaxLength,
MinLength,
} from 'class-validator';
import { i18nValidationMessage as i18n } from 'nestjs-i18n';
import { CountryIso } from '~/common/enums';
import { DEFAULT_OTP_LENGTH } from '~/common/modules/otp/constants';
import { IsAbove18 } from '~/core/decorators/validations';
import { CreateUnverifiedUserRequestDto } from './create-unverified-user.request.dto';
@@ -22,10 +32,11 @@ export class VerifyUserRequestDto extends PickType(CreateUnverifiedUserRequestDt
dateOfBirth!: Date;
@ApiProperty({ example: 'JO' })
@IsString({ message: i18n('validation.IsString', { path: 'general', property: 'customer.countryOfResidence' }) })
@IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'customer.countryOfResidence' }) })
@IsEnum(CountryIso, {
message: i18n('validation.IsEnum', { path: 'general', property: 'customer.countryOfResidence' }),
})
@IsOptional()
countryOfResidence: string = 'SA';
countryOfResidence: CountryIso = CountryIso.SAUDI_ARABIA;
@ApiProperty({ example: '111111' })
@IsNumberString(