(userId: string)
| 4 | import { prisma } from "~/server/db"; |
| 5 | |
| 6 | const isAdmin = async (userId: string) => { |
| 7 | const user = await prisma.user.findFirst({ |
| 8 | where: { id: userId, role: "ADMIN" }, |
| 9 | }); |
| 10 | |
| 11 | return !!user; |
| 12 | }; |
| 13 | |
| 14 | const requireUserId = (ctx: TRPCContext) => { |
| 15 | if (!ctx.session?.user.id) { |