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
+12
-1
@@ -8,6 +8,8 @@ import { adminGetTenantSubscriptionProductById, type TenantSubscriptionProductWi
|
||||
import { verifyUserHasPermission } from "~/utils/helpers/.server/PermissionsService";
|
||||
import { useLocaleFormatters } from "~/locale/format";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { runWithRlsContext } from "@hivegrid/db/rls-context.server";
|
||||
import { adminGetAllTenantsIdsAndNames } from "~/utils/db/tenants.db.server";
|
||||
|
||||
type LoaderData = {
|
||||
item: TenantSubscriptionProductWithTenant;
|
||||
@@ -15,7 +17,16 @@ type LoaderData = {
|
||||
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
|
||||
await verifyUserHasPermission(request, "admin.account.settings.update");
|
||||
const { t } = await getTranslations(request);
|
||||
const item = await adminGetTenantSubscriptionProductById(params.id!);
|
||||
const subscriptionProductId = params.id;
|
||||
if (!subscriptionProductId) {
|
||||
return Response.json({ error: t("admin.accounts.subscriptions.errors.notFound") }, { status: 404 });
|
||||
}
|
||||
const tenantOptions = await adminGetAllTenantsIdsAndNames();
|
||||
let item: TenantSubscriptionProductWithTenant | null = null;
|
||||
for (const tenant of tenantOptions) {
|
||||
item = await runWithRlsContext({ tenantId: tenant.id }, () => adminGetTenantSubscriptionProductById(subscriptionProductId));
|
||||
if (item) break;
|
||||
}
|
||||
if (!item) {
|
||||
return Response.json({ error: t("admin.accounts.subscriptions.errors.notFound") }, { status: 404 });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user