Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -5,6 +5,8 @@ import { deleteTenant } from "../db/tenants.db.server";
import { getTenantSubscription } from "../db/tenantSubscriptions.db.server";
import { TFunction } from "i18next";
import { cancelTenantSubscription } from "./.server/subscriptionService";
import EventsService from "~/modules/events/services/.server/EventsService";
import type { AccountDeletedDto } from "~/modules/events/dtos/AccountDeletedDto";
export function normalizeTenantSlug(slug: string) {
return UrlUtils.slugify(slug).toLowerCase();
@@ -53,9 +55,37 @@ export function validateDesiredTenantSlug(input: string): TenantSlugValidation {
return { ok: true, slug };
}
export async function deleteAndCancelTenant({ tenantId, userId, t }: { tenantId: string; userId: string; t?: TFunction }) {
export async function deleteAndCancelTenant({
tenantId,
userId,
request,
eventData,
authorizeDeletion,
t,
}: {
tenantId: string;
userId: string;
request?: Request;
eventData: AccountDeletedDto;
authorizeDeletion?: () => Promise<boolean>;
t?: TFunction;
}) {
await cancelAllTenantPlans({ t, tenantId, userId });
return await deleteTenant(tenantId);
return EventsService.createTenantEventBeforeMutation(
{
request,
event: "account.deleted",
tenantId,
userId,
data: eventData,
},
async () => {
if (authorizeDeletion && !(await authorizeDeletion())) {
throw new Error("Tenant deletion ownership changed before commit");
}
return deleteTenant(tenantId);
}
);
}
export async function cancelAllTenantPlans({ tenantId, userId, t }: { tenantId: string; userId: string; t?: TFunction }) {