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); }