chore: Set shouldServeCache to falsy, unless specified input (#24778)

This commit is contained in:
Alex van Andel authored and GitHub committed 2025-10-31 10:34:31 +00:00
1 parent 139e47fe3b
commit 1407886612
1 file changed
+13 -26
@@ -481,19 +481,6 @@ async function handler(
skipCalendarSyncTaskCreation = false,
} = input;
const {
/**
* TODO: In a followup PR, we aim to remove prisma dependency and instead inject the repositories as dependencies.
* This would require moving multiple queries to appropriate repositories.
*/
prismaClient: prisma,
bookingRepository,
userRepository,
cacheService,
checkBookingAndDurationLimitsService,
luckyUserService,
} = deps;
const isPlatformBooking = !!platformClientId;
const eventType = await getEventType({
@@ -533,7 +520,7 @@ async function handler(
reroutingFormResponses,
routingFormResponseId,
_isDryRun: isDryRun = false,
_shouldServeCache,
_shouldServeCache: shouldServeCache = false,
...reqBody
} = bookingData;
@@ -641,7 +628,7 @@ async function handler(
) {
const requiresPayment = !Number.isNaN(paymentAppData.price) && paymentAppData.price > 0;
const existingBooking = await bookingRepository.getValidBookingFromEventTypeForAttendee({
const existingBooking = await deps.bookingRepository.getValidBookingFromEventTypeForAttendee({
eventTypeId,
bookerEmail,
bookerPhoneNumber,
@@ -678,7 +665,7 @@ async function handler(
}
}
const shouldServeCache = await cacheService.getShouldServeCache(_shouldServeCache, eventType.team?.id);
// const shouldServeCache = await cacheService.getShouldServeCache(_shouldServeCache, eventType.team?.id);
const isTeamEventType =
!!eventType.schedulingType && ["COLLECTIVE", "ROUND_ROBIN"].includes(eventType.schedulingType);
@@ -747,7 +734,7 @@ async function handler(
if (routingFormResponseId === undefined) {
throw new HttpError({ statusCode: 400, message: "Missing routingFormResponseId" });
}
routingFormResponse = await prisma.app_RoutingForms_FormResponse.findUnique({
routingFormResponse = await deps.prismaClient.app_RoutingForms_FormResponse.findUnique({
where: {
id: routingFormResponseId,
},
@@ -790,7 +777,7 @@ async function handler(
});
if (!skipEventLimitsCheck) {
await checkBookingAndDurationLimitsService.checkBookingAndDurationLimits({
await deps.checkBookingAndDurationLimitsService.checkBookingAndDurationLimits({
eventType,
reqBodyStart: reqBody.start,
reqBodyRescheduleUid: reqBody.rescheduleUid,
@@ -802,7 +789,7 @@ async function handler(
let availableUsers: IsFixedAwareUser[] = [];
if (eventType.seatsPerTimeSlot) {
const booking = await prisma.booking.findFirst({
const booking = await deps.prismaClient.booking.findFirst({
where: {
eventTypeId: eventType.id,
startTime: new Date(dayjs(reqBody.start).utc().format()),
@@ -1010,7 +997,7 @@ async function handler(
memberId: eventTypeWithUsers.users[0].id ?? null,
teamId: eventType.teamId,
});
const newLuckyUser = await luckyUserService.getLuckyUser({
const newLuckyUser = await deps.luckyUserService.getLuckyUser({
// find a lucky user that is not already in the luckyUsers array
availableUsers: freeUsers,
// only hosts from the same group
@@ -1207,7 +1194,7 @@ async function handler(
: [];
const guestEmails = (reqGuests || []).map((email) => extractBaseEmail(email).toLowerCase());
const guestUsers = await userRepository.findManyByEmailsWithEmailVerificationSettings({
const guestUsers = await deps.userRepository.findManyByEmailsWithEmailVerificationSettings({
emails: guestEmails,
});
@@ -1291,7 +1278,7 @@ async function handler(
});
// For bookings made before introducing iCalSequence, assume that the sequence should start at 1. For new bookings start at 0.
const iCalSequence = getICalSequence(originalRescheduledBooking);
const organizerOrganizationProfile = await prisma.profile.findFirst({
const organizerOrganizationProfile = await deps.prismaClient.profile.findFirst({
where: {
userId: organizerUser.id,
},
@@ -1795,7 +1782,7 @@ async function handler(
// Save description to bookingSeat
const uniqueAttendeeId = uuid();
await prisma.bookingSeat.create({
await deps.prismaClient.bookingSeat.create({
data: {
referenceUid: uniqueAttendeeId,
data: {
@@ -2161,7 +2148,7 @@ async function handler(
if (!isDryRun && evt.iCalUID !== booking.iCalUID) {
// The eventManager could change the iCalUID. At this point we can update the DB record
await prisma.booking.update({
await deps.prismaClient.booking.update({
where: {
id: booking.id,
},
@@ -2284,7 +2271,7 @@ async function handler(
if (bookingRequiresPayment) {
loggerWithEventDetails.debug(`Booking ${organizerUser.username} requires payment`);
// Load credentials.app.categories
const credentialPaymentAppCategories = await prisma.credential.findMany({
const credentialPaymentAppCategories = await deps.prismaClient.credential.findMany({
where: {
...(paymentAppData.credentialId ? { id: paymentAppData.credentialId } : { userId: organizerUser.id }),
app: {
@@ -2502,7 +2489,7 @@ async function handler(
try {
if (!isDryRun) {
await prisma.booking.update({
await deps.prismaClient.booking.update({
where: {
uid: booking.uid,
},