Skip to content

Scheduling infrastructure for absolutely everyone.

432 B
Raw Blame
import { prisma } from "@calcom/prisma";

import type { TrpcSessionUser } from "../../../types";

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;
};