chore: upgrades to prisma v5 (#10073)

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Omar LópezandPeer Richelsen authored and GitHub committed 2023-08-07 22:08:13 +00:00
1 parent b9cec94880
commit 4b78e91384
8 files changed
+89 -74

No files matched your search

@@ -90,8 +90,11 @@ export default function CalComAdapter(prismaClient: PrismaClient) {
return { user, session };
},
createSession: (data: Prisma.SessionCreateInput) => prismaClient.session.create({ data }),
updateSession: (data: Prisma.SessionWhereUniqueInput) =>
prismaClient.session.update({ where: { sessionToken: data.sessionToken }, data }),
updateSession: (data: Prisma.SessionUpdateInput) =>
prismaClient.session.update({
where: { sessionToken: typeof data.sessionToken === "string" ? data.sessionToken : undefined },
data,
}),
deleteSession: (sessionToken: string) => prismaClient.session.delete({ where: { sessionToken } }),
};
}
@@ -11,9 +11,11 @@ import z from "zod";
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
import { metadata as GoogleMeetMetadata } from "@calcom/app-store/googlevideo/_metadata";
import type { LocationObject } from "@calcom/app-store/locations";
import { OrganizerDefaultConferencingAppType } from "@calcom/app-store/locations";
import { getLocationValueForDB } from "@calcom/app-store/locations";
import { MeetLocationType } from "@calcom/app-store/locations";
import {
getLocationValueForDB,
MeetLocationType,
OrganizerDefaultConferencingAppType,
} from "@calcom/app-store/locations";
import type { EventTypeAppsList } from "@calcom/app-store/utils";
import { getAppFromSlug } from "@calcom/app-store/utils";
import { cancelScheduledJobs, scheduleTrigger } from "@calcom/app-store/zapier/lib/nodeScheduler";
@@ -26,8 +28,8 @@ import {
sendAttendeeRequestEmail,
sendOrganizerRequestEmail,
sendRescheduledEmails,
sendScheduledEmails,
sendRescheduledSeatEmail,
sendScheduledEmails,
sendScheduledSeatsEmails,
} from "@calcom/emails";
import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields";
@@ -38,8 +40,8 @@ import {
allowDisablingHostConfirmationEmails,
} from "@calcom/features/ee/workflows/lib/allowDisablingStandardEmails";
import {
scheduleWorkflowReminders,
cancelWorkflowReminders,
scheduleWorkflowReminders,
} from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler";
import { getFullName } from "@calcom/features/form-builder/utils";
import type { GetSubscriberOptions } from "@calcom/features/webhooks/lib/getWebhooks";
@@ -47,7 +49,7 @@ import getWebhooks from "@calcom/features/webhooks/lib/getWebhooks";
import { isPrismaObjOrUndefined, parseRecurringEvent } from "@calcom/lib";
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
import { getDefaultEvent, getGroupName, getUsernameList } from "@calcom/lib/defaultEvents";
import { getDefaultEvent, getUsernameList } from "@calcom/lib/defaultEvents";
import { getErrorFromUnknown } from "@calcom/lib/errors";
import getIP from "@calcom/lib/getIP";
import getPaymentAppData from "@calcom/lib/getPaymentAppData";
@@ -65,9 +67,9 @@ import { getTimeFormatStringFromUserTimeFormat } from "@calcom/lib/timeFormat";
import prisma, { userSelect } from "@calcom/prisma";
import type { BookingReference } from "@calcom/prisma/client";
import { BookingStatus, SchedulingType, WebhookTriggerEvents } from "@calcom/prisma/enums";
import { bookingCreateSchemaLegacyPropsForApi } from "@calcom/prisma/zod-utils";
import {
bookingCreateBodySchemaForApi,
bookingCreateSchemaLegacyPropsForApi,
customInputSchema,
EventTypeMetaDataSchema,
extendedBookingCreateBody,
@@ -653,9 +655,7 @@ async function handler(
const tAttendees = await getTranslation(language ?? "en", "common");
const tGuests = await getTranslation("en", "common");
log.debug(`Booking eventType ${eventTypeId} started`);
const dynamicUserList = Array.isArray(reqBody.user)
? getGroupName(reqBody.user)
: getUsernameList(reqBody.user);
const dynamicUserList = Array.isArray(reqBody.user) ? reqBody.user : getUsernameList(reqBody.user);
if (!eventType) throw new HttpError({ statusCode: 404, message: "eventType.notFound" });
const isTeamEventType =
@@ -40,11 +40,7 @@ interface handleChildrenEventTypesProps {
};
}[]
| undefined;
prisma: PrismaClient<
Prisma.PrismaClientOptions,
never,
Prisma.RejectOnNotFound | Prisma.RejectPerOperation | undefined
>;
prisma: PrismaClient;
}
const sendAllSlugReplacementEmails = async (
+1 -5
View File
@@ -18,11 +18,7 @@ import { TRPCError } from "@trpc/server";
interface getEventTypeByIdProps {
eventTypeId: number;
userId: number;
prisma: PrismaClient<
Prisma.PrismaClientOptions,
never,
Prisma.RejectOnNotFound | Prisma.RejectPerOperation | undefined
>;
prisma: PrismaClient;
isTrpcCall?: boolean;
}
+3 -3
View File
@@ -24,9 +24,9 @@
},
"dependencies": {
"@calcom/lib": "*",
"@prisma/client": "^4.16.0",
"@prisma/generator-helper": "^4.13.0",
"prisma": "^4.16.0",
"@prisma/client": "^5.0.0",
"@prisma/generator-helper": "^5.0.0",
"prisma": "^5.0.0",
"ts-node": "^10.9.1",
"zod": "^3.20.2",
"zod-prisma": "^0.5.4"
+1 -1
View File
@@ -8,7 +8,7 @@ datasource db {
generator client {
provider = "prisma-client-js"
previewFeatures = ["views", "jsonProtocol"]
previewFeatures = ["views"]
}
generator zod {
@@ -150,7 +150,11 @@ export async function getDynamicEventType(input: TGetScheduleInputSchema) {
const users = await prisma.user.findMany({
where: {
username: {
in: input.usernameList,
in: Array.isArray(input.usernameList)
? input.usernameList
: input.usernameList
? [input.usernameList]
: [],
},
},
select: {