Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+7
-4
@@ -1,4 +1,5 @@
|
||||
import type { Prisma } from "@hivegrid/db/prisma-browser";
|
||||
import { runWithRlsContext } from "@hivegrid/db/rls-context.server";
|
||||
|
||||
import { db } from "~/utils/db.server";
|
||||
|
||||
@@ -18,8 +19,10 @@ export async function withTenantRLS<T>(tenantId: string, callback: (tx: TenantRl
|
||||
if (!tenantId) {
|
||||
throw new Error("withTenantRLS requires a non-empty tenantId");
|
||||
}
|
||||
return db.$transaction(async (tx: TenantRlsClient) => {
|
||||
await tx.$executeRaw`SELECT set_config('app.tenant_id', ${tenantId}, true)`;
|
||||
return callback(tx);
|
||||
});
|
||||
return runWithRlsContext({ tenantId }, () =>
|
||||
db.$transaction(async (tx: TenantRlsClient) => {
|
||||
await tx.$executeRaw`SELECT set_config('app.tenant_id', ${tenantId}, true)`;
|
||||
return callback(tx);
|
||||
}),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user