diff --git a/src/modules/user/handlers/authentication/registration.ts b/src/modules/user/handlers/authentication/registration.ts index 710ab0d..f35026a 100644 --- a/src/modules/user/handlers/authentication/registration.ts +++ b/src/modules/user/handlers/authentication/registration.ts @@ -1,7 +1,7 @@ import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from 'aws-lambda'; import * as bcrypt from 'bcryptjs'; import { prismaClient } from '../../../../common/database/prisma.lambda.service'; -import { ROLE } from '../../../../common/utils/constants/common.constant'; +import { ROLE, USER_STATUS } from '../../../../common/utils/constants/common.constant'; import { safeHandler } from '../../../../common/utils/handlers/safeHandler'; import ApiError from '../../../../common/utils/helper/ApiError'; import { encryptUserId } from '../../../../common/utils/helper/CodeGenerator'; @@ -43,7 +43,7 @@ export const handler = safeHandler(async ( // Use a single transaction for user creation/lookup and OTP storage const transactionResult = await prismaClient.$transaction(async (tx) => { const user = await tx.user.findFirst({ - where: { mobileNumber: mobileNumber, isActive: true }, + where: { mobileNumber: mobileNumber, isActive: true, userStatus: USER_STATUS.ACTIVE }, select: { id: true, userPasscode: true, mobileNumber: true }, }); @@ -64,7 +64,8 @@ export const handler = safeHandler(async ( id: ROLE.USER, // 👈 Role ID }, }, - userRefNumber: referenceNumber + userRefNumber: referenceNumber, + userStatus: USER_STATUS.ACTIVE }, }); }