uuid automate in booking API

pull/9078/head
Syed Ali Shahbaz 2022-06-11 16:57:35 +05:30
parent 110edd7dcc
commit 61e742ed5e
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,6 @@ const schemaBookingBaseBodyParams = Booking.pick({
const schemaBookingCreateParams = z
.object({
uid: z.string(),
eventTypeId: z.number(),
title: z.string(),
startTime: z.date().or(z.string()),

View File

@ -1,5 +1,6 @@
import { WebhookTriggerEvents } from "@prisma/client";
import type { NextApiRequest, NextApiResponse } from "next";
import { v4 as uuidv4 } from "uuid";
import prisma from "@calcom/prisma";
@ -82,7 +83,7 @@ async function createOrlistAllBookings(
return;
}
safe.data.userId = userId;
const data = await prisma.booking.create({ data: { ...safe.data } });
const data = await prisma.booking.create({ data: { id: uuidv4(), ...safe.data } });
const booking = schemaBookingReadPublic.parse(data);
if (booking) {