isAdmin: publicProcedure
.input(
z.object({
userId: z.string(),
})
)
.query(async ({ ctx, input }): Promise<boolean> => {
return await ctx.prisma.user
.findUnique({
where: {
id: input.userId,
},
})
.then((user) => {
if (user?.role === "ADMIN") return true;
return false;
});
}),
isAdmin: publicProcedure
.input(
z.object({
userId: z.string(),
})
)
.query(async ({ ctx, input }): Promise<boolean> => {
return await ctx.prisma.user
.findUnique({
where: {
id: input.userId,
},
})
.then((user) => {
if (user?.role === "ADMIN") return true;
return false;
});
}),