feat: add sentry middleware

This commit is contained in:
nafees nazik
2024-07-08 14:57:33 +05:30
parent ca17bb2210
commit c6c08f420e
+4 -6
View File
@@ -70,10 +70,8 @@ export type withAuthTrpcContextType = ReturnType<typeof withAuthTrpcContext>;
const withAccessControlTrpcContext = async ({
meta,
...rest
}: CreateTRPCContextType & { meta: Meta | undefined }) => {
const ctx = withAuthTrpcContext({ ...rest });
...ctx
}: withAuthTrpcContextType & { meta: Meta | undefined }) => {
const rbac = new RBAC();
if (meta?.policies) {
@@ -207,11 +205,11 @@ export const withoutAuth = t.procedure;
export const withAuth = t.procedure.use(authMiddleware);
export const withAccessControl = t.procedure.use(
async ({ ctx: ctx_, next, meta }) => {
authMiddleware.unstable_pipe(async ({ ctx: ctx_, next, meta }) => {
const ctx = await withAccessControlTrpcContext({ ...ctx_, meta });
return next({
ctx,
});
},
}),
);