diff --git a/src/auth/dtos/user-otp.dto.ts b/src/auth/dtos/user-otp.dto.ts index b588cb2..043eebc 100644 --- a/src/auth/dtos/user-otp.dto.ts +++ b/src/auth/dtos/user-otp.dto.ts @@ -1,6 +1,12 @@ import { OtpType } from '../../../libs/common/src/constants/otp-type.enum'; import { ApiProperty } from '@nestjs/swagger'; -import { IsEmail, IsEnum, IsNotEmpty, IsString } from 'class-validator'; +import { + IsEmail, + IsEnum, + IsNotEmpty, + IsOptional, + IsString, +} from 'class-validator'; export class UserOtpDto { @ApiProperty() @@ -14,9 +20,9 @@ export class UserOtpDto { type: OtpType; @ApiProperty() - @IsNotEmpty() + @IsOptional() @IsString() - regionName: string; + regionUuid?: string; } export class VerifyOtpDto extends UserOtpDto { diff --git a/src/auth/services/user-auth.service.ts b/src/auth/services/user-auth.service.ts index fe459cb..085807a 100644 --- a/src/auth/services/user-auth.service.ts +++ b/src/auth/services/user-auth.service.ts @@ -130,9 +130,13 @@ export class UserAuthService { threeDaysAgo.setDate(threeDaysAgo.getDate() - 3); const userExists = await this.userRepository.exists({ where: { - region: { - regionName: data.regionName, - }, + region: data.regionUuid + ? { + uuid: data.regionUuid, + } + : { + regionName: 'United Arab Emirates', + }, email: data.email, isUserVerified: true, },