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>
This commit is contained in:
Ash Davis
2025-03-03 18:19:09 +00:00
committed by GitHub
co-authored by Anik Dhabal Babu
parent 340f15fea5
commit 5a6a13b954
+11 -3
View File
@@ -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);
}