Scheduling infrastructure for absolutely everyone.
Add logging (#21874)
Joe Au-Yeung3b19ede6a339
diff --git a/packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.ts b/packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.tsindex 152a587dd82..6b565ae4af9 100644--- a/packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.ts+++ b/packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.ts@@ -1,8 +1,11 @@import { ErrorCode } from "@calcom/lib/errorCodes";import { ErrorWithCode } from "@calcom/lib/errors";+import logger from "@calcom/lib/logger";import prisma from "@calcom/prisma";import { BookingStatus } from "@calcom/prisma/enums";+const log = logger.getSubLogger({ prefix: ["[checkActiveBookingsLimitForBooker]"] });+export const checkActiveBookingsLimitForBooker = async ({eventTypeId,maxActiveBookingsPerBooker,@@ -57,6 +60,7 @@ const checkActiveBookingsLimit = async ({});if (bookingsCount >= maxActiveBookingsPerBooker) {+ log.warn(`Maximum booking limit reached for ${bookerEmail} for event type ${eventTypeId}`);throw new ErrorWithCode(ErrorCode.BookerLimitExceeded, ErrorCode.BookerLimitExceeded);}};@@ -104,6 +108,7 @@ const checkActiveBookingsLimitAndOfferReschedule = async ({const lastBooking = bookingsCount[bookingsCount.length - 1];if (bookingsCount.length >= maxActiveBookingsPerBooker) {+ log.warn(`Maximum booking limit reached for ${bookerEmail} for event type ${eventTypeId}`);throw new ErrorWithCode(ErrorCode.BookerLimitExceededReschedule,ErrorCode.BookerLimitExceededReschedule,