diff --git a/src/modules/host/services/host.service.ts b/src/modules/host/services/host.service.ts index 6175754..1f8ecda 100644 --- a/src/modules/host/services/host.service.ts +++ b/src/modules/host/services/host.service.ts @@ -368,6 +368,19 @@ export class HostService { async addPaymentDetails(data: AddPaymentDetailsDTO) { return await this.prisma.$transaction(async (tx) => { + const existingAccount = await tx.hostBankDetails.findFirst({ + where: { + accountNumber: data.accountNumber, + isActive: true, + }, + }); + + if (existingAccount) { + throw new ApiError( + 400, + 'Host account with this account number already exists.' + ); + } const addedPaymentDetails = await tx.hostBankDetails.create({ data, });