2
0
Files

21 lines
431 B
TypeScript
Raw Permalink Normal View History

2024-08-09 00:39:27 +02:00
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "../../../trpc";
type CheckForGCalOptions = {
ctx: {
user: NonNullable<TrpcSessionUser>;
};
};
export const checkForGCalHandler = async ({ ctx }: CheckForGCalOptions) => {
const gCalPresent = await prisma.credential.findFirst({
where: {
type: "google_calendar",
userId: ctx.user.id,
},
});
return !!gCalPresent;
};