push
This commit is contained in:
@@ -43,6 +43,7 @@ export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
|
||||
export const memberProcedure = protectedProcedure.use(async ({ ctx, next }) => {
|
||||
const userRole = await ctx.prisma.userRole.findFirst({
|
||||
where: { userId: ctx.session.user.id },
|
||||
orderBy: { createdAt: 'asc' },
|
||||
})
|
||||
if (!userRole) {
|
||||
throw new TRPCError({
|
||||
@@ -65,6 +66,7 @@ export const memberProcedure = protectedProcedure.use(async ({ ctx, next }) => {
|
||||
export const adminProcedure = protectedProcedure.use(async ({ ctx, next }) => {
|
||||
const userRole = await ctx.prisma.userRole.findFirst({
|
||||
where: { userId: ctx.session.user.id, role: 'admin' },
|
||||
orderBy: { createdAt: 'asc' },
|
||||
})
|
||||
if (!userRole) {
|
||||
throw new TRPCError({
|
||||
|
||||
Reference in New Issue
Block a user