From 5ae502c262c56d9a465046c257a39779f3496e30 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Wed, 29 Mar 2023 18:59:34 +0300 Subject: [PATCH] Revert "trpc: check unlimited in middleware" This reverts commit 90c0ef481b03bfb7d1a822dfa9e667f59f2c27b2. --- apps/web/server/middleware.ts | 6 ------ apps/web/server/routers/calculate/index.ts | 2 +- apps/web/server/routers/quote/index.ts | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/apps/web/server/middleware.ts b/apps/web/server/middleware.ts index 7347334..ac633b1 100644 --- a/apps/web/server/middleware.ts +++ b/apps/web/server/middleware.ts @@ -27,12 +27,6 @@ export const userMiddleware = t.middleware(async ({ ctx, next }) => { const unlimited = systemuser?.roles?.some((x) => x?.name && unlimitedRoles.includes(x.name)); - if (!unlimited) { - throw new TRPCError({ - code: 'UNAUTHORIZED', - }); - } - return next({ ctx: { unlimited, diff --git a/apps/web/server/routers/calculate/index.ts b/apps/web/server/routers/calculate/index.ts index 50aceb9..67230f7 100644 --- a/apps/web/server/routers/calculate/index.ts +++ b/apps/web/server/routers/calculate/index.ts @@ -17,7 +17,7 @@ export const calculateRouter = router({ const apolloClient = initializeApollo(); const queryClient = new QueryClient(); - if (ctx.unlimited === false) { + if (!ctx.unlimited) { const validationResult = await validate({ context: { apolloClient, diff --git a/apps/web/server/routers/quote/index.ts b/apps/web/server/routers/quote/index.ts index 463d8b1..4fa50d1 100644 --- a/apps/web/server/routers/quote/index.ts +++ b/apps/web/server/routers/quote/index.ts @@ -91,7 +91,7 @@ export const quoteRouter = router({ const apolloClient = initializeApollo(); const queryClient = new QueryClient(); - if (ctx.unlimited === false) { + if (!ctx.unlimited) { const validationResult = await validate({ context: { apolloClient,