export const isUserDeckOwner = async (
deckId: string,
userId: string,
prisma: PrismaClient
) => {
const deck = await prisma.deck.findFirst({
where: {
id: deckId,
},
});
if (deck?.userId != userId) {
throw new TRPCError({
code: "FORBIDDEN",
message: "You don't have permission to access this deck",
});
}
};
export const isUserDeckOwner = async (
deckId: string,
userId: string,
prisma: PrismaClient
) => {
const deck = await prisma.deck.findFirst({
where: {
id: deckId,
},
});
if (deck?.userId != userId) {
throw new TRPCError({
code: "FORBIDDEN",
message: "You don't have permission to access this deck",
});
}
};