Revert "trpc: check unlimited in middleware"

This reverts commit 90c0ef481b03bfb7d1a822dfa9e667f59f2c27b2.
This commit is contained in:
vchikalkin 2023-03-29 18:59:34 +03:00
parent 9c3fa098b8
commit 5ae502c262
3 changed files with 2 additions and 8 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,