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
@@ -1,5 +1,6 @@
|
||||
import { getDbClient, type DbClient } from "./client.server.js";
|
||||
import type {
|
||||
Prisma,
|
||||
SubscriptionFeature,
|
||||
SubscriptionPrice,
|
||||
SubscriptionProduct,
|
||||
@@ -23,7 +24,7 @@ export type SubscriptionUsageBasedPriceWithProduct = SubscriptionUsageBasedPrice
|
||||
|
||||
export type SubscriptionProductCreateInput = Pick<
|
||||
SubscriptionProduct,
|
||||
| "stripeId"
|
||||
| "billingProviderId"
|
||||
| "order"
|
||||
| "title"
|
||||
| "model"
|
||||
@@ -36,12 +37,15 @@ export type SubscriptionProductCreateInput = Pick<
|
||||
| "billingAddressCollection"
|
||||
| "hasQuantity"
|
||||
| "canBuyAgain"
|
||||
>;
|
||||
> &
|
||||
Partial<Pick<SubscriptionProduct, "code" | "lagoPlanCode">>;
|
||||
|
||||
export type SubscriptionProductUpdateInput = Partial<
|
||||
Pick<
|
||||
SubscriptionProduct,
|
||||
| "stripeId"
|
||||
| "billingProviderId"
|
||||
| "code"
|
||||
| "lagoPlanCode"
|
||||
| "order"
|
||||
| "title"
|
||||
| "model"
|
||||
@@ -57,12 +61,13 @@ export type SubscriptionProductUpdateInput = Partial<
|
||||
>;
|
||||
|
||||
export type SubscriptionPriceCreateInput = Omit<
|
||||
Pick<SubscriptionPrice, "subscriptionProductId" | "stripeId" | "type" | "billingPeriod" | "price" | "currency" | "trialDays" | "active">,
|
||||
Pick<SubscriptionPrice, "subscriptionProductId" | "billingProviderId" | "type" | "billingPeriod" | "price" | "currency" | "trialDays" | "active">,
|
||||
"price"
|
||||
> & { price: SubscriptionPrice["price"] | number | string };
|
||||
> &
|
||||
Partial<Pick<SubscriptionPrice, "lagoFeeCode" | "molliePriceReference">> & { price: SubscriptionPrice["price"] | number | string };
|
||||
|
||||
export type SubscriptionPriceUpdateInput = Partial<
|
||||
Omit<Pick<SubscriptionPrice, "stripeId" | "type" | "billingPeriod" | "price" | "currency" | "trialDays" | "active">, "price"> & {
|
||||
Omit<Pick<SubscriptionPrice, "billingProviderId" | "lagoFeeCode" | "molliePriceReference" | "type" | "billingPeriod" | "price" | "currency" | "trialDays" | "active">, "price"> & {
|
||||
price: SubscriptionPrice["price"] | number | string;
|
||||
}
|
||||
>;
|
||||
@@ -70,7 +75,7 @@ export type SubscriptionPriceUpdateInput = Partial<
|
||||
export type SubscriptionUsageBasedPriceCreateInput = Pick<
|
||||
SubscriptionUsageBasedPrice,
|
||||
| "subscriptionProductId"
|
||||
| "stripeId"
|
||||
| "billingProviderId"
|
||||
| "currency"
|
||||
| "billingPeriod"
|
||||
| "unit"
|
||||
@@ -90,10 +95,12 @@ export type SubscriptionUsageBasedTierCreateInput = Omit<
|
||||
flatFeePrice?: SubscriptionUsageBasedTier["flatFeePrice"] | number | string | null;
|
||||
};
|
||||
|
||||
export type SubscriptionFeatureCreateInput = Omit<SubscriptionFeature, "id" | "subscriptionProductId" | "href" | "badge" | "accumulate"> & {
|
||||
export type SubscriptionFeatureCreateInput = Omit<SubscriptionFeature, "id" | "subscriptionProductId" | "href" | "badge" | "accumulate" | "code" | "quotaValue"> & {
|
||||
href?: string | null;
|
||||
badge?: string | null;
|
||||
accumulate?: boolean;
|
||||
code?: string | null;
|
||||
quotaValue?: Prisma.NullableJsonNullValueInput | Prisma.InputJsonValue;
|
||||
};
|
||||
|
||||
export type SubscriptionProductPriceWithDetails = Omit<SubscriptionPrice, "id"> & {
|
||||
@@ -112,6 +119,7 @@ export type SubscriptionProductWithDetails = Omit<SubscriptionProduct, "id"> & {
|
||||
|
||||
export type SubscriptionFeatureSummary = {
|
||||
name: string;
|
||||
code?: string | null;
|
||||
order: number;
|
||||
title: string;
|
||||
type: number;
|
||||
@@ -170,19 +178,22 @@ export type TenantSubscriptionProductPage = {
|
||||
};
|
||||
};
|
||||
|
||||
export type TenantSubscriptionCreateInput = Pick<TenantSubscription, "tenantId" | "stripeCustomerId">;
|
||||
export type TenantSubscriptionCreateInput = Pick<TenantSubscription, "tenantId"> &
|
||||
Partial<Pick<TenantSubscription, "billingProviderCustomerId" | "lagoCustomerId" | "mollieCustomerId" | "planCode" | "seatQuantity">>;
|
||||
|
||||
export type TenantSubscriptionCustomerIdUpdateInput = Pick<TenantSubscription, "stripeCustomerId">;
|
||||
export type TenantSubscriptionCustomerIdUpdateInput = Partial<
|
||||
Pick<TenantSubscription, "billingProviderCustomerId" | "lagoCustomerId" | "mollieCustomerId" | "planCode" | "seatQuantity" | "lastInvoiceExternalId" | "lastPaymentExternalId">
|
||||
>;
|
||||
|
||||
export type TenantSubscriptionProductCreateInput = Pick<
|
||||
TenantSubscriptionProduct,
|
||||
| "tenantSubscriptionId"
|
||||
| "subscriptionProductId"
|
||||
| "stripeSubscriptionId"
|
||||
| "billingProviderSubscriptionId"
|
||||
| "quantity"
|
||||
| "fromCheckoutSessionId"
|
||||
> &
|
||||
Partial<Pick<TenantSubscriptionProduct, "customEntitlementPlanId">> & {
|
||||
Partial<Pick<TenantSubscriptionProduct, "customEntitlementPlanId" | "lagoSubscriptionId" | "planCode" | "seatQuantity">> & {
|
||||
prices: {
|
||||
subscriptionPriceId?: string;
|
||||
subscriptionUsageBasedPriceId?: string;
|
||||
@@ -190,7 +201,10 @@ export type TenantSubscriptionProductCreateInput = Pick<
|
||||
};
|
||||
|
||||
export type TenantSubscriptionProductUpdateInput = Partial<
|
||||
Pick<TenantSubscriptionProduct, "quantity" | "cancelledAt" | "endsAt" | "currentPeriodStart" | "currentPeriodEnd" | "customEntitlementPlanId">
|
||||
Pick<
|
||||
TenantSubscriptionProduct,
|
||||
"quantity" | "seatQuantity" | "planCode" | "lagoSubscriptionId" | "cancelledAt" | "endsAt" | "currentPeriodStart" | "currentPeriodEnd" | "customEntitlementPlanId"
|
||||
>
|
||||
>;
|
||||
|
||||
export type TenantSubscriptionProductCustomEntitlementPlanUpdateInput = Pick<TenantSubscriptionProduct, "customEntitlementPlanId">;
|
||||
@@ -199,18 +213,48 @@ export type TenantSubscriptionProductCancelInput = Pick<TenantSubscriptionProduc
|
||||
|
||||
export type TenantSubscriptionUsageRecordCreateInput = Pick<
|
||||
TenantSubscriptionUsageRecord,
|
||||
"tenantSubscriptionProductPriceId" | "timestamp" | "quantity" | "stripeSubscriptionItemId"
|
||||
>;
|
||||
"tenantId" | "tenantSubscriptionId" | "tenantSubscriptionProductPriceId" | "metricCode" | "timestamp" | "quantity" | "billingProviderSubscriptionItemId"
|
||||
> &
|
||||
Partial<Pick<TenantSubscriptionUsageRecord, "idempotencyKey">>;
|
||||
|
||||
export type CheckoutSessionStatusCreateInput = Pick<CheckoutSessionStatus, "id" | "email" | "fromUrl"> &
|
||||
Partial<Pick<CheckoutSessionStatus, "fromUserId" | "fromTenantId">>;
|
||||
Partial<
|
||||
Pick<
|
||||
CheckoutSessionStatus,
|
||||
| "fromUserId"
|
||||
| "fromTenantId"
|
||||
| "provider"
|
||||
| "providerPaymentId"
|
||||
| "invoiceExternalId"
|
||||
| "subscriptionProductId"
|
||||
| "subscriptionPriceId"
|
||||
| "lagoSubscriptionId"
|
||||
| "planCode"
|
||||
| "quantity"
|
||||
| "amountCents"
|
||||
| "currency"
|
||||
| "checkoutUrl"
|
||||
| "status"
|
||||
>
|
||||
>;
|
||||
|
||||
export type CheckoutSessionStatusUpdateInput = Pick<CheckoutSessionStatus, "pending"> &
|
||||
Partial<Pick<CheckoutSessionStatus, "createdUserId" | "createdTenantId">>;
|
||||
Partial<
|
||||
Pick<
|
||||
CheckoutSessionStatus,
|
||||
| "createdUserId"
|
||||
| "createdTenantId"
|
||||
| "providerPaymentId"
|
||||
| "invoiceExternalId"
|
||||
| "lagoSubscriptionId"
|
||||
| "checkoutUrl"
|
||||
| "status"
|
||||
>
|
||||
>;
|
||||
|
||||
export type TenantIdResult = { tenantId: string };
|
||||
|
||||
export type StripeTenantSubscriptionProduct = Pick<TenantSubscriptionProduct, "id" | "endsAt" | "cancelledAt" | "customEntitlementPlanId"> & {
|
||||
export type BillingProviderTenantSubscriptionProduct = Pick<TenantSubscriptionProduct, "id" | "endsAt" | "cancelledAt" | "customEntitlementPlanId"> & {
|
||||
tenantSubscription: Pick<TenantSubscription, "tenantId"> & {
|
||||
tenant: {
|
||||
id: string;
|
||||
@@ -220,7 +264,7 @@ export type StripeTenantSubscriptionProduct = Pick<TenantSubscriptionProduct, "i
|
||||
subscriptionProduct: Pick<SubscriptionProduct, "id" | "title">;
|
||||
};
|
||||
|
||||
export type StripeTenantSubscriptionProductUpdate = {
|
||||
export type BillingProviderTenantSubscriptionProductUpdate = {
|
||||
cancelledAt?: Date | null;
|
||||
currentPeriodStart?: Date;
|
||||
currentPeriodEnd?: Date;
|
||||
@@ -274,7 +318,7 @@ const tenantSubscriptionDetailsInclude = {
|
||||
},
|
||||
} as const;
|
||||
|
||||
const stripeTenantSubscriptionProductSelect = {
|
||||
const billingProviderTenantSubscriptionProductSelect = {
|
||||
id: true,
|
||||
endsAt: true,
|
||||
cancelledAt: true,
|
||||
@@ -313,9 +357,9 @@ export type SubscriptionCatalogClient = {
|
||||
where: { id: string };
|
||||
include: typeof subscriptionProductDetailsInclude;
|
||||
}): Promise<SubscriptionProductWithDetails | null>;
|
||||
findFirst(args: { where: { stripeId: string } }): Promise<SubscriptionProduct | null>;
|
||||
findFirst(args: { where: { billingProviderId: string } }): Promise<SubscriptionProduct | null>;
|
||||
create(args: { data: SubscriptionProductCreateInput }): Promise<SubscriptionProduct>;
|
||||
update(args: { where: { id: string }; data: SubscriptionProductUpdateInput | { stripeId: string } }): Promise<SubscriptionProduct>;
|
||||
update(args: { where: { id: string }; data: SubscriptionProductUpdateInput | { billingProviderId: string } }): Promise<SubscriptionProduct>;
|
||||
delete(args: { where: { id: string } }): Promise<SubscriptionProduct>;
|
||||
};
|
||||
subscriptionPrice: {
|
||||
@@ -324,13 +368,13 @@ export type SubscriptionCatalogClient = {
|
||||
orderBy: [{ subscriptionProduct: { order: "asc" } }, { price: "asc" }];
|
||||
}): Promise<SubscriptionPriceWithProduct[]>;
|
||||
findUnique(args: { where: { id: string }; include: { subscriptionProduct: true } }): Promise<SubscriptionPriceWithProduct | null>;
|
||||
findFirst(args: { where: { stripeId: string }; include: { subscriptionProduct: true } }): Promise<SubscriptionPriceWithProduct | null>;
|
||||
findFirst(args: { where: { billingProviderId: string }; include: { subscriptionProduct: true } }): Promise<SubscriptionPriceWithProduct | null>;
|
||||
create(args: { data: SubscriptionPriceCreateInput }): Promise<SubscriptionPrice>;
|
||||
update(args: { where: { id: string }; data: SubscriptionPriceUpdateInput | { stripeId: string } }): Promise<SubscriptionPrice>;
|
||||
update(args: { where: { id: string }; data: SubscriptionPriceUpdateInput | { billingProviderId: string } }): Promise<SubscriptionPrice>;
|
||||
delete(args: { where: { id: string } }): Promise<SubscriptionPrice>;
|
||||
};
|
||||
subscriptionUsageBasedPrice: {
|
||||
findFirst(args: { where: { stripeId: string }; include: { subscriptionProduct: true } }): Promise<SubscriptionUsageBasedPriceWithProduct | null>;
|
||||
findFirst(args: { where: { billingProviderId: string }; include: { subscriptionProduct: true } }): Promise<SubscriptionUsageBasedPriceWithProduct | null>;
|
||||
create(args: { data: SubscriptionUsageBasedPriceCreateInput }): Promise<SubscriptionUsageBasedPrice>;
|
||||
delete(args: { where: { id: string } }): Promise<SubscriptionUsageBasedPrice>;
|
||||
};
|
||||
@@ -340,7 +384,7 @@ export type SubscriptionCatalogClient = {
|
||||
};
|
||||
subscriptionFeature: {
|
||||
findMany(args: {
|
||||
select: { name: true; order: true; title: true; type: true; value: true; accumulate: true };
|
||||
select: { name: true; code: true; order: true; title: true; type: true; value: true; accumulate: true };
|
||||
}): Promise<SubscriptionFeatureSummary[]>;
|
||||
create(args: { data: SubscriptionFeatureCreateInput & { subscriptionProductId: string } }): Promise<SubscriptionFeature>;
|
||||
deleteMany(args: { where: { subscriptionProductId: string } }): Promise<{ count: number }>;
|
||||
@@ -387,7 +431,7 @@ export type TenantBillingClient = TenantSubscriptionReaderClient & {
|
||||
}): Promise<TenantSubscriptionProductWithTenant[]>;
|
||||
count(args: { where: TenantSubscriptionProductWhereInput }): Promise<number>;
|
||||
findFirst(args: {
|
||||
where: { tenantSubscription: { tenantId: string }; subscriptionProductId: string } | { id: string; tenantSubscription: { tenantId: string } } | { stripeSubscriptionId: string };
|
||||
where: { tenantSubscription: { tenantId: string }; subscriptionProductId: string } | { id: string; tenantSubscription: { tenantId: string } } | { billingProviderSubscriptionId: string };
|
||||
include: typeof tenantSubscriptionProductWithTenantInclude;
|
||||
}): Promise<TenantSubscriptionProductWithTenant | null>;
|
||||
findUnique(args: { where: { id: string }; include: typeof tenantSubscriptionProductWithTenantInclude }): Promise<TenantSubscriptionProductWithTenant | null>;
|
||||
@@ -423,15 +467,15 @@ export type TenantBillingClient = TenantSubscriptionReaderClient & {
|
||||
};
|
||||
};
|
||||
|
||||
export type StripeTenantSubscriptionProductClient = {
|
||||
export type BillingProviderTenantSubscriptionProductClient = {
|
||||
tenantSubscriptionProduct: {
|
||||
findFirst(args: {
|
||||
where: { stripeSubscriptionId: string };
|
||||
select: typeof stripeTenantSubscriptionProductSelect;
|
||||
}): Promise<StripeTenantSubscriptionProduct | null>;
|
||||
where: { billingProviderSubscriptionId: string };
|
||||
select: typeof billingProviderTenantSubscriptionProductSelect;
|
||||
}): Promise<BillingProviderTenantSubscriptionProduct | null>;
|
||||
update(args: {
|
||||
where: { id: string };
|
||||
data: StripeTenantSubscriptionProductUpdate;
|
||||
data: BillingProviderTenantSubscriptionProductUpdate;
|
||||
select: { tenantSubscription: { select: { tenantId: true } } };
|
||||
}): Promise<{ tenantSubscription: { tenantId: string } }>;
|
||||
};
|
||||
@@ -503,7 +547,7 @@ export async function getAllSubscriptionFeatures(
|
||||
client: SubscriptionProductReaderClient = getDbClient(),
|
||||
): Promise<SubscriptionFeatureSummary[]> {
|
||||
return await client.subscriptionFeature.findMany({
|
||||
select: { name: true, order: true, title: true, type: true, value: true, accumulate: true },
|
||||
select: { name: true, code: true, order: true, title: true, type: true, value: true, accumulate: true },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -519,13 +563,13 @@ export async function getSubscriptionProduct(
|
||||
});
|
||||
}
|
||||
|
||||
export async function getSubscriptionProductByStripeId(
|
||||
stripeId: string,
|
||||
export async function getSubscriptionProductByBillingProviderId(
|
||||
billingProviderId: string,
|
||||
client: SubscriptionCatalogClient = getDbClient(),
|
||||
): Promise<SubscriptionProduct | null> {
|
||||
return await client.subscriptionProduct.findFirst({
|
||||
where: {
|
||||
stripeId,
|
||||
billingProviderId,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -570,13 +614,13 @@ export async function getSubscriptionPrice(
|
||||
});
|
||||
}
|
||||
|
||||
export async function getSubscriptionPriceByStripeId(
|
||||
stripeId: string,
|
||||
export async function getSubscriptionPriceByBillingProviderId(
|
||||
billingProviderId: string,
|
||||
client: SubscriptionCatalogClient = getDbClient(),
|
||||
): Promise<SubscriptionPriceWithProduct | null> {
|
||||
return await client.subscriptionPrice
|
||||
.findFirst({
|
||||
where: { stripeId },
|
||||
where: { billingProviderId },
|
||||
include: {
|
||||
subscriptionProduct: true,
|
||||
},
|
||||
@@ -586,13 +630,13 @@ export async function getSubscriptionPriceByStripeId(
|
||||
});
|
||||
}
|
||||
|
||||
export async function getSubscriptionUsageBasedPriceByStripeId(
|
||||
stripeId: string,
|
||||
export async function getSubscriptionUsageBasedPriceByBillingProviderId(
|
||||
billingProviderId: string,
|
||||
client: SubscriptionCatalogClient = getDbClient(),
|
||||
): Promise<SubscriptionUsageBasedPriceWithProduct | null> {
|
||||
return await client.subscriptionUsageBasedPrice
|
||||
.findFirst({
|
||||
where: { stripeId },
|
||||
where: { billingProviderId },
|
||||
include: {
|
||||
subscriptionProduct: true,
|
||||
},
|
||||
@@ -620,9 +664,9 @@ export async function updateSubscriptionProduct(
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateSubscriptionProductStripeId(
|
||||
export async function updateSubscriptionProductBillingProviderId(
|
||||
id: string,
|
||||
data: { stripeId: string },
|
||||
data: { billingProviderId: string },
|
||||
client: SubscriptionCatalogClient = getDbClient(),
|
||||
): Promise<SubscriptionProduct> {
|
||||
return await client.subscriptionProduct.update({
|
||||
@@ -631,9 +675,9 @@ export async function updateSubscriptionProductStripeId(
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateSubscriptionPriceStripeId(
|
||||
export async function updateSubscriptionPriceBillingProviderId(
|
||||
id: string,
|
||||
data: { stripeId: string },
|
||||
data: { billingProviderId: string },
|
||||
client: SubscriptionCatalogClient = getDbClient(),
|
||||
): Promise<SubscriptionPrice> {
|
||||
return await client.subscriptionPrice.update({
|
||||
@@ -877,12 +921,12 @@ export async function getTenantSubscriptionProductById(
|
||||
});
|
||||
}
|
||||
|
||||
export async function getTenantSubscriptionProductByStripeSubscriptionId(
|
||||
stripeSubscriptionId: string,
|
||||
export async function getTenantSubscriptionProductByBillingProviderSubscriptionId(
|
||||
billingProviderSubscriptionId: string,
|
||||
client: TenantBillingClient = getTenantBillingClient(),
|
||||
): Promise<TenantSubscriptionProductWithTenant | null> {
|
||||
return await client.tenantSubscriptionProduct.findFirst({
|
||||
where: { stripeSubscriptionId },
|
||||
where: { billingProviderSubscriptionId },
|
||||
include: tenantSubscriptionProductWithTenantInclude,
|
||||
});
|
||||
}
|
||||
@@ -895,7 +939,10 @@ export async function addTenantSubscriptionProduct(
|
||||
data: {
|
||||
tenantSubscriptionId: data.tenantSubscriptionId,
|
||||
subscriptionProductId: data.subscriptionProductId,
|
||||
stripeSubscriptionId: data.stripeSubscriptionId,
|
||||
billingProviderSubscriptionId: data.billingProviderSubscriptionId,
|
||||
lagoSubscriptionId: data.lagoSubscriptionId,
|
||||
planCode: data.planCode,
|
||||
seatQuantity: data.seatQuantity,
|
||||
quantity: data.quantity,
|
||||
fromCheckoutSessionId: data.fromCheckoutSessionId,
|
||||
customEntitlementPlanId: data.customEntitlementPlanId,
|
||||
@@ -994,6 +1041,18 @@ export async function createCheckoutSessionStatus(
|
||||
fromUrl: data.fromUrl,
|
||||
fromUserId: data.fromUserId ?? null,
|
||||
fromTenantId: data.fromTenantId ?? null,
|
||||
provider: data.provider ?? null,
|
||||
providerPaymentId: data.providerPaymentId ?? null,
|
||||
invoiceExternalId: data.invoiceExternalId ?? null,
|
||||
subscriptionProductId: data.subscriptionProductId ?? null,
|
||||
subscriptionPriceId: data.subscriptionPriceId ?? null,
|
||||
lagoSubscriptionId: data.lagoSubscriptionId ?? null,
|
||||
planCode: data.planCode ?? null,
|
||||
quantity: data.quantity ?? 1,
|
||||
amountCents: data.amountCents ?? null,
|
||||
currency: data.currency ?? null,
|
||||
checkoutUrl: data.checkoutUrl ?? null,
|
||||
status: data.status ?? "open",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1009,6 +1068,11 @@ export async function updateCheckoutSessionStatus(
|
||||
pending: data.pending,
|
||||
createdUserId: data.createdUserId ?? null,
|
||||
createdTenantId: data.createdTenantId ?? null,
|
||||
providerPaymentId: data.providerPaymentId ?? undefined,
|
||||
invoiceExternalId: data.invoiceExternalId ?? undefined,
|
||||
lagoSubscriptionId: data.lagoSubscriptionId ?? undefined,
|
||||
checkoutUrl: data.checkoutUrl ?? undefined,
|
||||
status: data.status ?? undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1020,22 +1084,22 @@ export async function createTenantSubscriptionUsageRecord(
|
||||
return await client.tenantSubscriptionUsageRecord.create({ data });
|
||||
}
|
||||
|
||||
export async function findTenantSubscriptionProductByStripeSubscriptionId(
|
||||
stripeSubscriptionId: string,
|
||||
client: StripeTenantSubscriptionProductClient = getDbClient() as unknown as StripeTenantSubscriptionProductClient,
|
||||
): Promise<StripeTenantSubscriptionProduct | null> {
|
||||
export async function findTenantSubscriptionProductByBillingProviderSubscriptionId(
|
||||
billingProviderSubscriptionId: string,
|
||||
client: BillingProviderTenantSubscriptionProductClient = getDbClient() as unknown as BillingProviderTenantSubscriptionProductClient,
|
||||
): Promise<BillingProviderTenantSubscriptionProduct | null> {
|
||||
return client.tenantSubscriptionProduct.findFirst({
|
||||
where: {
|
||||
stripeSubscriptionId,
|
||||
billingProviderSubscriptionId,
|
||||
},
|
||||
select: stripeTenantSubscriptionProductSelect,
|
||||
select: billingProviderTenantSubscriptionProductSelect,
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateTenantSubscriptionProductFromStripe(
|
||||
export async function updateTenantSubscriptionProductFromBillingProvider(
|
||||
id: string,
|
||||
data: StripeTenantSubscriptionProductUpdate,
|
||||
client: StripeTenantSubscriptionProductClient = getDbClient() as unknown as StripeTenantSubscriptionProductClient,
|
||||
data: BillingProviderTenantSubscriptionProductUpdate,
|
||||
client: BillingProviderTenantSubscriptionProductClient = getDbClient() as unknown as BillingProviderTenantSubscriptionProductClient,
|
||||
): Promise<{ tenantId: string }> {
|
||||
const item = await client.tenantSubscriptionProduct.update({
|
||||
where: { id },
|
||||
|
||||
Reference in new issue
Block a user