Skip to content

Commit e54cb13

Browse files
Merge branch 'main' into feat/crm-integrations-revert
2 parents 60ecc13 + cb30e5f commit e54cb13

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

packages/features/bookings/lib/handleNewBooking.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ export const findBookingQuery = async (bookingId: number) => {
864864
description: true,
865865
status: true,
866866
responses: true,
867+
metadata: true,
867868
user: {
868869
select: {
869870
name: true,

packages/features/bookings/lib/handleSeats/handleSeats.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ const handleSeats = async (newSeatedBookingObject: NewSeatedBookingObject) => {
9696

9797
// If the resultBooking is defined we should trigger workflows else, trigger in handleNewBooking
9898
if (resultBooking) {
99-
// Obtain event metadata that includes videoCallUrl
100-
const metadata = evt.videoCallData?.url ? { videoCallUrl: evt.videoCallData.url } : undefined;
99+
const metadata = {
100+
...(typeof resultBooking.metadata === "object" && resultBooking.metadata),
101+
...reqBodyMetadata,
102+
};
101103
try {
102104
await scheduleWorkflowReminders({
103105
workflows: eventType.workflows,
@@ -126,7 +128,7 @@ const handleSeats = async (newSeatedBookingObject: NewSeatedBookingObject) => {
126128
rescheduleEndTime: originalRescheduledBooking?.endTime
127129
? dayjs(originalRescheduledBooking?.endTime).utc().format()
128130
: undefined,
129-
metadata: { ...metadata, ...reqBodyMetadata },
131+
metadata,
130132
eventTypeId,
131133
status: "ACCEPTED",
132134
smsReminderNumber: seatedBooking?.smsReminderNumber || undefined,

packages/features/bookings/lib/handleSeats/test/handleSeats.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ describe("handleSeats", () => {
187187
body: mockBookingData,
188188
});
189189

190-
await handleNewBooking(req);
190+
const createdBooking = await handleNewBooking(req);
191+
192+
expect(createdBooking.metadata).toHaveProperty("videoCallUrl");
191193

192194
const handleSeatsCall = spy.mock.calls[0][0];
193195

0 commit comments

Comments
 (0)