fix: Generate new idempotency key when round robin reassigning (#22065)

* Create idempotencyKeyService

* Use `idempotencyKeyService` in middleware

* Use `idempotencyKeyService` in RR reassignments
This commit is contained in:
Joe Au-Yeung authored and GitHub committed 2025-06-26 17:43:31 +00:00
1 parent 2bbd92db13
commit b0999abc68
4 files changed
+42 -7

No files matched your search

@@ -24,6 +24,7 @@ import { SENDER_NAME } from "@calcom/lib/constants";
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
import { getEventName } from "@calcom/lib/event";
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
import { IdempotencyKeyService } from "@calcom/lib/idempotencyKey/idempotencyKeyService";
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
import logger from "@calcom/lib/logger";
import { getTranslation } from "@calcom/lib/server/i18n";
@@ -181,6 +182,12 @@ export const roundRobinManualReassignment = async ({
userPrimaryEmail: newUser.email,
reassignReason,
reassignById: reassignedById,
idempotencyKey: IdempotencyKeyService.generate({
startTime: booking.startTime,
endTime: booking.endTime,
userId: newUser.id,
reassignedById,
}),
},
select: bookingSelect,
});
@@ -21,6 +21,8 @@ import {
enrichUserWithDelegationCredentialsIncludeServiceAccountKey,
} from "@calcom/lib/delegationCredential/server";
import { getEventName } from "@calcom/lib/event";
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
import { IdempotencyKeyService } from "@calcom/lib/idempotencyKey/idempotencyKeyService";
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
import logger from "@calcom/lib/logger";
import { getLuckyUser } from "@calcom/lib/server/getLuckyUser";
@@ -238,6 +240,12 @@ export const roundRobinReassignment = async ({
userId: reassignedRRHost.id,
userPrimaryEmail: reassignedRRHost.email,
title: newBookingTitle,
idempotencyKey: IdempotencyKeyService.generate({
startTime: booking.startTime,
endTime: booking.endTime,
userId: reassignedRRHost.id,
reassignedById,
}),
},
select: bookingSelect,
});