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
@@ -3,15 +3,15 @@ import {
|
||||
createUniqueLegacyTenantIpAddress,
|
||||
findLegacyTenantByIdOrSlug,
|
||||
getLegacyTenantMembershipsForUser,
|
||||
} from "@toolctrl/db/accounts.server";
|
||||
} from "@hivegrid/db/accounts.server";
|
||||
import {
|
||||
createLegacyApiKeyLog,
|
||||
findLegacyApiKeyByKey,
|
||||
setLegacyApiKeyLogStatus as setApiKeyLogStatus,
|
||||
type LegacyApiKeySimple,
|
||||
} from "@toolctrl/db/api-keys.server";
|
||||
import type { ApiKeyLog } from "@toolctrl/db/prisma-browser";
|
||||
import { findLegacyUserWithoutPasswordById } from "@toolctrl/db/users.server";
|
||||
} from "@hivegrid/db/api-keys.server";
|
||||
import type { ApiKeyLog } from "@hivegrid/db/prisma-browser";
|
||||
import { findLegacyUserWithoutPasswordById } from "@hivegrid/db/users.server";
|
||||
import { Params } from "react-router";
|
||||
import { DefaultFeatures } from "~/application/dtos/shared/DefaultFeatures";
|
||||
import { getActiveTenantSubscriptions, getPlanFeatureUsage } from "./.server/subscriptionService";
|
||||
@@ -19,11 +19,10 @@ import { PlanFeatureUsageDto } from "~/application/dtos/subscriptions/PlanFeatur
|
||||
import { getClientIPAddress } from "../server/IpUtils";
|
||||
import jwt from "jsonwebtoken";
|
||||
import NotificationService from "~/modules/notifications/services/.server/NotificationService";
|
||||
import { getOpenInvoices } from "../stripe.server";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { rateLimitByKey } from "./rateLimitService";
|
||||
import { cachified } from "../cache.server";
|
||||
import { loadApiConfig, loadRequiredWebConfig } from "@toolctrl/config";
|
||||
import { loadApiConfig, loadRequiredWebConfig } from "@hivegrid/config";
|
||||
import { absoluteAppPath } from "../app/CrossHostUrls";
|
||||
import { getApiKeyLookupCacheKey, serializeApiLogSearchParams } from "../api/apiKeySecurity.server";
|
||||
|
||||
@@ -268,24 +267,6 @@ export async function validateTenantApiKey(request: Request, params: Params): Pr
|
||||
});
|
||||
throw await setApiError(request, params, t(usage.message), 402, { id: apiKeyLog.id, tenantId: apiKey.tenantId });
|
||||
}
|
||||
if (tenantSubscription && tenantSubscription.stripeCustomerId) {
|
||||
const openInvoices = await getOpenInvoices(tenantSubscription.stripeCustomerId);
|
||||
if (openInvoices.data.length > 0) {
|
||||
const invoicesDescription = openInvoices.data.map((invoice) => `Invoice #${invoice.number} - ${invoice.total} ${invoice.currency}`).join("\n");
|
||||
await NotificationService.sendToRoles({
|
||||
channel: "admin-users",
|
||||
tenantId: null,
|
||||
notification: {
|
||||
message: `${apiKey.tenant.name} (${apiKey.tenant.slug}) API error. You have open invoices: ${invoicesDescription}`,
|
||||
action: {
|
||||
url: absoluteAppPath(loadRequiredWebConfig().routing, apiKey.tenant.slug, "settings/api/keys"),
|
||||
},
|
||||
},
|
||||
});
|
||||
throw await setApiError(request, params, "You have open invoices: " + invoicesDescription, 402, { id: apiKeyLog.id, tenantId: apiKey.tenantId });
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
tenant: apiKey.tenant,
|
||||
tenantApiKey: {
|
||||
|
||||
Reference in new issue
Block a user