What are you using for authorization?
Hey, so I got started on the "full" T3 stack recently and I'm wondering what everyone here is using for authorization?
export const enforceUserIsAuthorized = async (
userId: string,
teensyId: number,
) => {
try {
const teensy = await prisma.teensy.findUnique({
where: { id: teensyId },
});
if (!teensy || teensy.ownerId !== userId) {
throw new Error("Not authorized");
}
} catch (e) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
};await enforceUserIsAuthorized(ctx.session.user.id, input.id);