fix: schedule no show webhooks for requires confirmation event (#17089)

This commit is contained in:
Udit Takkar
2024-10-18 07:50:15 -07:00
committed by GitHub
parent 73c35ba5a2
commit 912d3cf5b2
2 changed files with 20 additions and 3 deletions
@@ -27,6 +27,8 @@ import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
import { getAllWorkflowsFromEventType } from "@calcom/trpc/server/routers/viewer/workflows/util";
import type { AdditionalInformation, CalendarEvent } from "@calcom/types/Calendar";
import { scheduleNoShowTriggers } from "./handleNewBooking/scheduleNoShowTriggers";
const log = logger.getSubLogger({ prefix: ["[handleConfirmation] book:user"] });
export async function handleConfirmation(args: {
@@ -36,6 +38,8 @@ export async function handleConfirmation(args: {
prisma: PrismaClient;
bookingId: number;
booking: {
startTime: Date;
id: number;
eventType: {
currency: string;
description: string | null;
@@ -393,6 +397,18 @@ export async function handleConfirmation(args: {
await Promise.all(scheduleTriggerPromises);
await scheduleNoShowTriggers({
booking: {
startTime: booking.startTime,
id: booking.id,
},
triggerForUser,
organizerUser: { id: booking.userId },
eventTypeId: booking.eventTypeId,
teamId,
orgId,
});
const eventTypeInfo: EventTypeInfo = {
eventTitle: eventType?.title,
eventDescription: eventType?.description,
@@ -8,15 +8,16 @@ type ScheduleNoShowTriggersArgs = {
startTime: Date;
id: number;
};
triggerForUser: number | true | null;
organizerUser: { id: number };
eventTypeId: number;
triggerForUser?: number | true | null;
organizerUser: { id: number | null };
eventTypeId: number | null;
teamId?: number | null;
orgId?: number | null;
};
export const scheduleNoShowTriggers = async (args: ScheduleNoShowTriggersArgs) => {
const { booking, triggerForUser, organizerUser, eventTypeId, teamId, orgId } = args;
// Add task for automatic no show in cal video
const noShowPromises: Promise<any>[] = [];