fix: slug value in webhook payload (#12290)
Co-authored-by: Udit Takkar <udit222001@gmail.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com>
This commit is contained in:
co-authored by
Udit Takkar
CarinaWolli
parent
9eb2ae470c
commit
77fa3702db
@@ -103,12 +103,11 @@ test.describe("BOOKING_CREATED", async () => {
|
||||
body.payload.videoCallData = dynamic;
|
||||
body.payload.appsStatus = dynamic;
|
||||
body.payload.metadata.videoCallUrl = dynamic;
|
||||
|
||||
expect(body).toMatchObject({
|
||||
triggerEvent: "BOOKING_CREATED",
|
||||
createdAt: "[redacted/dynamic]",
|
||||
payload: {
|
||||
type: "30 min",
|
||||
type: "30-min",
|
||||
title: "30 min between Nameless and Test Testson",
|
||||
description: "",
|
||||
additionalNotes: "",
|
||||
@@ -236,7 +235,7 @@ test.describe("BOOKING_REJECTED", async () => {
|
||||
triggerEvent: "BOOKING_REJECTED",
|
||||
createdAt: "[redacted/dynamic]",
|
||||
payload: {
|
||||
type: "Opt in",
|
||||
type: "opt-in",
|
||||
title: "Opt in between Nameless and Test Testson",
|
||||
customInputs: {},
|
||||
startTime: "[redacted/dynamic]",
|
||||
@@ -357,7 +356,7 @@ test.describe("BOOKING_REQUESTED", async () => {
|
||||
triggerEvent: "BOOKING_REQUESTED",
|
||||
createdAt: "[redacted/dynamic]",
|
||||
payload: {
|
||||
type: "Opt in",
|
||||
type: "opt-in",
|
||||
title: "Opt in between Nameless and Test Testson",
|
||||
customInputs: {},
|
||||
startTime: "[redacted/dynamic]",
|
||||
|
||||
@@ -1261,7 +1261,7 @@ export function getExpectedCalEventForBookingRequest({
|
||||
}) {
|
||||
return {
|
||||
// keep adding more fields as needed, so that they can be verified in all scenarios
|
||||
type: eventType.title,
|
||||
type: eventType.slug,
|
||||
// Not sure why, but milliseconds are missing in cal Event.
|
||||
startTime: bookingRequest.start.replace(".000Z", "Z"),
|
||||
endTime: bookingRequest.end.replace(".000Z", "Z"),
|
||||
|
||||
@@ -224,7 +224,7 @@ async function handler(req: CustomRequest) {
|
||||
|
||||
const evt: CalendarEvent = {
|
||||
title: bookingToDelete?.title,
|
||||
type: (bookingToDelete?.eventType?.title as string) || bookingToDelete?.title,
|
||||
type: bookingToDelete?.eventType?.slug as string,
|
||||
description: bookingToDelete?.description || "",
|
||||
customInputs: isPrismaObjOrUndefined(bookingToDelete.customInputs),
|
||||
...getCalEventResponses({
|
||||
@@ -504,7 +504,7 @@ async function handler(req: CustomRequest) {
|
||||
// Avoiding taking care of recurrence for now as Payments are not supported with Recurring Events at the moment
|
||||
if (bookingToDelete && bookingToDelete.paid) {
|
||||
const evt: CalendarEvent = {
|
||||
type: bookingToDelete?.eventType?.title as string,
|
||||
type: bookingToDelete?.eventType?.slug as string,
|
||||
title: bookingToDelete.title,
|
||||
description: bookingToDelete.description ?? "",
|
||||
customInputs: isPrismaObjOrUndefined(bookingToDelete.customInputs),
|
||||
|
||||
@@ -1103,7 +1103,7 @@ async function handler(
|
||||
|
||||
let evt: CalendarEvent = {
|
||||
bookerUrl: await getBookerUrl(organizerUser),
|
||||
type: eventType.title,
|
||||
type: eventType.slug,
|
||||
title: getEventName(eventNameObject), //this needs to be either forced in english, or fetched for each attendee and organizer separately
|
||||
description: eventType.description,
|
||||
additionalNotes,
|
||||
|
||||
@@ -85,7 +85,7 @@ export async function getBooking(bookingId: number) {
|
||||
const attendeesList = await Promise.all(attendeesListPromises);
|
||||
const selectedDestinationCalendar = booking.destinationCalendar || user.destinationCalendar;
|
||||
const evt: CalendarEvent = {
|
||||
type: booking.title,
|
||||
type: booking?.eventType?.slug as string,
|
||||
title: booking.title,
|
||||
description: booking.description || undefined,
|
||||
startTime: booking.startTime.toISOString(),
|
||||
|
||||
@@ -56,6 +56,7 @@ export const confirmHandler = async ({ ctx, input }: ConfirmOptions) => {
|
||||
teamId: true,
|
||||
recurringEvent: true,
|
||||
title: true,
|
||||
slug: true,
|
||||
requiresConfirmation: true,
|
||||
currency: true,
|
||||
length: true,
|
||||
@@ -151,7 +152,7 @@ export const confirmHandler = async ({ ctx, input }: ConfirmOptions) => {
|
||||
const attendeesList = await Promise.all(attendeesListPromises);
|
||||
|
||||
const evt: CalendarEvent = {
|
||||
type: booking.eventType?.title || booking.title,
|
||||
type: booking?.eventType?.slug as string,
|
||||
title: booking.title,
|
||||
description: booking.description,
|
||||
// TODO: Remove the usage of `bookingFields` in computing responses. We can do that by storing `label` with the response. Also, this would allow us to correctly show the label for a field even after the Event Type has been deleted.
|
||||
|
||||
@@ -177,7 +177,7 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule
|
||||
builder.init({
|
||||
title: bookingToReschedule.title,
|
||||
bookerUrl: await getBookerUrl(user),
|
||||
type: event && event.title ? event.title : bookingToReschedule.title,
|
||||
type: event && event.slug ? event.slug : bookingToReschedule.title,
|
||||
startTime: bookingToReschedule.startTime.toISOString(),
|
||||
endTime: bookingToReschedule.endTime.toISOString(),
|
||||
attendees: usersToPeopleType(
|
||||
@@ -236,7 +236,7 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule
|
||||
|
||||
const evt: CalendarEvent = {
|
||||
title: bookingToReschedule?.title,
|
||||
type: event && event.title ? event.title : bookingToReschedule.title,
|
||||
type: event && event.slug ? event.slug : bookingToReschedule.title,
|
||||
description: bookingToReschedule?.description || "",
|
||||
customInputs: isPrismaObjOrUndefined(bookingToReschedule.customInputs),
|
||||
...getCalEventResponses({
|
||||
|
||||
Reference in New Issue
Block a user