cal.pub0.org/lib/utils/isAdmin.ts

9 lines
273 B
TypeScript

import { UserPermissionRole } from "@prisma/client";
import prisma from "@calcom/prisma";
export const isAdminGuard = async (userId: number) => {
const user = await prisma.user.findUnique({ where: { id: userId } });
return user?.role === UserPermissionRole.ADMIN;
};