Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+2
-29
@@ -1,10 +1,7 @@
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { findEntityByName } from "../../db/entities/entities.db.server";
|
||||
import { createTenant } from "../../db/tenants.db.server";
|
||||
import { getUser, updateUserDefaultTenantId } from "../../db/users.db.server";
|
||||
import { getUserInfo } from "../../session.server";
|
||||
import { createStripeCustomer } from "../../stripe.server";
|
||||
import { RowsApi } from "./RowsApi";
|
||||
import { TenantTypesApi } from "./TenantTypesApi";
|
||||
import EventsService from "../../../modules/events/services/.server/EventsService";
|
||||
import { AccountCreatedDto } from "~/modules/events/dtos/AccountCreatedDto";
|
||||
@@ -12,7 +9,7 @@ import { autosubscribeToTrialOrFreePlan } from "../../services/.server/pricingSe
|
||||
import { appPath } from "../../app/CanonicalUrlUtils";
|
||||
|
||||
export namespace TenantsApi {
|
||||
export async function create({ request, form, name, slug }: { request: Request; form: FormData; name: string; slug?: string }) {
|
||||
export async function create({ request, name, slug }: { request: Request; name: string; slug?: string }) {
|
||||
const { t } = await getTranslations(request);
|
||||
let userInfo = await getUserInfo(request);
|
||||
const user = await getUser(userInfo.userId);
|
||||
@@ -23,15 +20,7 @@ export namespace TenantsApi {
|
||||
throw new Error("Name is required");
|
||||
}
|
||||
|
||||
let stripeCustomerId: string | undefined;
|
||||
if (process.env.STRIPE_SK) {
|
||||
const stripeCustomer = await createStripeCustomer(user?.email, name);
|
||||
if (!stripeCustomer) {
|
||||
throw new Error("Could not create Stripe customer");
|
||||
}
|
||||
stripeCustomerId = stripeCustomer.id;
|
||||
}
|
||||
const tenant = await createTenant({ name, subscriptionCustomerId: stripeCustomerId, slug });
|
||||
const tenant = await createTenant({ name, slug });
|
||||
|
||||
await updateUserDefaultTenantId({ defaultTenantId: tenant.id }, user.id);
|
||||
|
||||
@@ -48,22 +37,6 @@ export namespace TenantsApi {
|
||||
} satisfies AccountCreatedDto,
|
||||
});
|
||||
|
||||
const tenantSettingsEntity = await findEntityByName({ tenantId: null, name: "tenantSettings" });
|
||||
if (tenantSettingsEntity) {
|
||||
try {
|
||||
await RowsApi.createCustom({
|
||||
request,
|
||||
entity: tenantSettingsEntity,
|
||||
tenantId: tenant.id,
|
||||
t,
|
||||
form,
|
||||
row: undefined,
|
||||
});
|
||||
} catch (e: any) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
await TenantTypesApi.setTenantTypes({ tenantId: tenant.id });
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user