uuid automate in booking API

This commit is contained in:
Syed Ali Shahbaz committed 2022-06-11 16:57:35 +05:30
1 parent 110edd7dcc
commit 61e742ed5e
2 files changed
+2 -2

No files matched your search

-1
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()),
+2 -1
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) {