Files
calendar/apps/web/pages/api/book/event.ts
T
e5af99f572 Moved booking logic to calcom/features (#4960)
* Moved booking logic to calcom/features

Needed to reuse on public API

* Type fixes

* Cleanup

* Cleanup

* Cleanup

* Restored still needed V1 pages

This reverts commit 790a304a6aa3b9e16525ea3b015bef773f36ded1.

Co-authored-by: Alex van Andel <me@alexvanandel.com>
2022-10-12 13:04:51 +00:00

16 lines
514 B
TypeScript

import type { NextApiRequest } from "next";
import handleNewBooking from "@calcom/features/bookings/lib/handleNewBooking";
import { getSession } from "@calcom/lib/auth";
import { defaultResponder } from "@calcom/lib/server";
async function handler(req: NextApiRequest & { userId?: number }) {
const session = await getSession({ req });
/* To mimic API behavior */
req.userId = session?.user?.id;
const booking = await handleNewBooking(req);
return booking;
}
export default defaultResponder(handler);