From 5a6a13b9549a1b3c1ad0ac003720a52842e37442 Mon Sep 17 00:00:00 2001 From: Ash Davis <11312962+Shpadoinkle@users.noreply.github.com> Date: Tue, 4 Mar 2025 05:19:09 +1100 Subject: [PATCH] fix: allow cancelledBy query param to work on api v1 (#19268) * fix: cancelledby to work on api v1 * fix: scheduleId to work with hosts in eventtype api v1 * Update event-type.ts --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> --- apps/api/v1/pages/api/bookings/[id]/_delete.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/api/v1/pages/api/bookings/[id]/_delete.ts b/apps/api/v1/pages/api/bookings/[id]/_delete.ts index 984306305b..fd911ad976 100644 --- a/apps/api/v1/pages/api/bookings/[id]/_delete.ts +++ b/apps/api/v1/pages/api/bookings/[id]/_delete.ts @@ -38,6 +38,12 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform * schema: * type: string * description: The reason for cancellation of the booking + * - in: query + * name: cancelledBy + * required: false + * schema: + * type: string + * description: The email of who cancelled the booking * tags: * - bookings * responses: @@ -64,15 +70,17 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform * description: User not found */ async function handler(req: NextApiRequest) { - const { id, allRemainingBookings, cancellationReason } = schemaQueryIdParseInt - .merge(bookingCancelSchema.pick({ allRemainingBookings: true, cancellationReason: true })) + const { id, allRemainingBookings, cancellationReason, cancelledBy } = schemaQueryIdParseInt + .merge( + bookingCancelSchema.pick({ allRemainingBookings: true, cancellationReason: true, cancelledBy: true }) + ) .parse({ ...req.query, allRemainingBookings: req.query.allRemainingBookings === "true", }); // Normalizing for universal handler - req.body = { id, allRemainingBookings, cancellationReason }; + req.body = { id, allRemainingBookings, cancellationReason, cancelledBy }; return await handleCancelBooking(req); }