2022-05-31 16:33:01 +00:00
|
|
|
import prisma from "@calcom/prisma";
|
2022-05-31 18:46:09 +00:00
|
|
|
import { UserPermissionRole } from "@calcom/prisma/client";
|
2022-05-31 16:33:01 +00:00
|
|
|
|
|
|
|
export const isAdminGuard = async (userId: number) => {
|
|
|
|
const user = await prisma.user.findUnique({ where: { id: userId } });
|
2022-05-31 18:46:09 +00:00
|
|
|
return user?.role === UserPermissionRole.ADMIN;
|
2022-05-31 16:33:01 +00:00
|
|
|
};
|