fix: improve admin check using enum instead of string
parent
187d5f2b10
commit
7f42cc8479
|
@ -1,6 +1,7 @@
|
|||
import prisma from "@calcom/prisma";
|
||||
import { UserPermissionRole } from "@calcom/prisma/client";
|
||||
|
||||
export const isAdminGuard = async (userId: number) => {
|
||||
const user = await prisma.user.findUnique({ where: { id: userId } });
|
||||
return user?.role === "ADMIN";
|
||||
return user?.role === UserPermissionRole.ADMIN;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue