mutate context dbUser along with db changes

This commit is contained in:
Michael Dausmann
2023-02-25 18:34:56 +11:00
parent a341a641e8
commit 61bab50aef
3 changed files with 19 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ import { ACCOUNT_ACCESS } from '@prisma/client';
const t = initTRPC.context<Context>().create()
/**
* auth middleware
* auth middlewares
**/
const isAuthed = t.middleware(({ next, ctx }) => {
if (!ctx.user) {
@@ -45,7 +45,7 @@ const isAdminForInputAccountId = t.middleware(({ next, rawInput, ctx }) => {
});
/**
* Unprotected procedure
* Procedures
**/
export const publicProcedure = t.procedure;
export const protectedProcedure = t.procedure.use(isAuthed);