feat: refactor handleCancelBooking to not have next request (#20241)
* refactor handleCancelBooking to not have next request * fix platform v2 function calls * dont fall back to "" if no seat refrence * add missing type from merge * chore: bump platform libraries --------- Co-authored-by: Amit Sharma <[email protected]> Co-authored-by: Lauris Skraucis <[email protected]> Co-authored-by: supalarry <[email protected]>
This commit is contained in:
10 files changed
+89
-67
No files matched your search
@@ -5,6 +5,7 @@ import type { NextRequest } from "next/server";
|
||||
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import handleCancelBooking from "@calcom/features/bookings/lib/handleCancelBooking";
|
||||
import { bookingCancelInput } from "@calcom/prisma/zod-utils";
|
||||
|
||||
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
|
||||
|
||||
@@ -16,8 +17,9 @@ async function handler(req: NextRequest) {
|
||||
return NextResponse.json({ success: false, message: "Invalid JSON" }, { status: 400 });
|
||||
}
|
||||
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
|
||||
const bookingData = bookingCancelInput.parse(appDirRequestBody);
|
||||
const result = await handleCancelBooking({
|
||||
appDirRequestBody,
|
||||
bookingData,
|
||||
userId: session?.user?.id || -1,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user