Skip to content

Commit

Permalink
fix: schedule no show webhooks for requires confirmation event (#17089)
Browse files Browse the repository at this point in the history
  • Loading branch information
Udit-takkar authored Oct 18, 2024
1 parent 73c35ba commit 912d3cf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 16 additions & 0 deletions packages/features/bookings/lib/handleConfirmation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -36,6 +38,8 @@ export async function handleConfirmation(args: {
prisma: PrismaClient;
bookingId: number;
booking: {
startTime: Date;
id: number;
eventType: {
currency: string;
description: string | null;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>[] = [];

Expand Down

0 comments on commit 912d3cf

Please sign in to comment.