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
@@ -1,8 +1,27 @@
|
||||
enum SubscriptionProductKind {
|
||||
base_plan
|
||||
recurring_add_on
|
||||
one_time_setup
|
||||
contract_override
|
||||
}
|
||||
|
||||
enum TenantProductAcquisitionStatus {
|
||||
pending
|
||||
provider_pending
|
||||
payment_pending
|
||||
active
|
||||
failed
|
||||
cancelled
|
||||
expired
|
||||
refunded
|
||||
}
|
||||
|
||||
model SubscriptionProduct {
|
||||
id String @id @default(cuid())
|
||||
billingProviderId String
|
||||
code String?
|
||||
lagoPlanCode String?
|
||||
kind SubscriptionProductKind @default(base_plan)
|
||||
order Int
|
||||
title String
|
||||
active Boolean
|
||||
@@ -18,9 +37,8 @@ model SubscriptionProduct {
|
||||
prices SubscriptionPrice[]
|
||||
features SubscriptionFeature[]
|
||||
tenantProducts TenantSubscriptionProduct[]
|
||||
acquisitions TenantProductAcquisition[]
|
||||
usageBasedPrices SubscriptionUsageBasedPrice[]
|
||||
assignsTenantTypes TenantType[]
|
||||
|
||||
@@index([code])
|
||||
@@index([lagoPlanCode])
|
||||
}
|
||||
@@ -30,8 +48,12 @@ model SubscriptionPrice {
|
||||
subscriptionProductId String
|
||||
subscriptionProduct SubscriptionProduct @relation(fields: [subscriptionProductId], references: [id], onDelete: Cascade)
|
||||
billingProviderId String
|
||||
lagoPlanCode String?
|
||||
lagoFeeCode String?
|
||||
molliePriceReference String?
|
||||
billingCadence String @default("monthly")
|
||||
contractMonths Int @default(1)
|
||||
requiredPaymentMethod String @default("any")
|
||||
type Int
|
||||
billingPeriod Int
|
||||
price Decimal
|
||||
@@ -39,7 +61,9 @@ model SubscriptionPrice {
|
||||
trialDays Int
|
||||
active Boolean
|
||||
tenantProductPrices TenantSubscriptionProductPrice[]
|
||||
acquisitions TenantProductAcquisition[]
|
||||
|
||||
@@index([lagoPlanCode])
|
||||
@@index([lagoFeeCode])
|
||||
@@index([molliePriceReference])
|
||||
}
|
||||
@@ -98,6 +122,11 @@ model TenantSubscription {
|
||||
mollieCustomerId String?
|
||||
planCode String?
|
||||
seatQuantity Int @default(1)
|
||||
officeSeatQuantity Int @default(0)
|
||||
fieldSeatQuantity Int @default(0)
|
||||
billingCadence String @default("monthly")
|
||||
commitmentEndsAt DateTime?
|
||||
storageAddOnCodes String[] @default([])
|
||||
lastInvoiceExternalId String?
|
||||
lastPaymentExternalId String?
|
||||
status String @default("trial")
|
||||
@@ -133,6 +162,11 @@ model TenantSubscriptionProduct {
|
||||
lagoSubscriptionId String?
|
||||
planCode String?
|
||||
seatQuantity Int?
|
||||
officeSeatQuantity Int?
|
||||
fieldSeatQuantity Int?
|
||||
billingCadence String @default("monthly")
|
||||
commitmentEndsAt DateTime?
|
||||
storageAddOnCodes String[] @default([])
|
||||
quantity Int?
|
||||
fromCheckoutSessionId String?
|
||||
currentPeriodStart DateTime?
|
||||
@@ -140,11 +174,69 @@ model TenantSubscriptionProduct {
|
||||
tenantSubscription TenantSubscription @relation(fields: [tenantSubscriptionId], references: [id], onDelete: Cascade)
|
||||
subscriptionProduct SubscriptionProduct @relation(fields: [subscriptionProductId], references: [id])
|
||||
prices TenantSubscriptionProductPrice[]
|
||||
acquisition TenantProductAcquisition?
|
||||
|
||||
@@index([lagoSubscriptionId])
|
||||
@@index([planCode])
|
||||
}
|
||||
|
||||
/// Idempotent tenant-owned ledger for products acquired outside the one-base-plan
|
||||
/// lifecycle. `scopeKey` is the stable business scope (for example `tenant` or a
|
||||
/// normalized hostname) and makes provider retries safe without granting the same
|
||||
/// entitlement twice. Provider failures remain local to this row and must never
|
||||
/// mutate the base TenantSubscription status.
|
||||
model TenantProductAcquisition {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String
|
||||
subscriptionProductId String
|
||||
subscriptionPriceId String?
|
||||
productKind SubscriptionProductKind
|
||||
scopeKey String
|
||||
requestHash String
|
||||
status TenantProductAcquisitionStatus @default(pending)
|
||||
version Int @default(1)
|
||||
quantity Int @default(1)
|
||||
amountCents Int?
|
||||
currency String?
|
||||
checkoutSessionId String? @unique
|
||||
tenantSubscriptionProductId String? @unique
|
||||
provider String?
|
||||
providerAttempt Int @default(1)
|
||||
providerPaymentId String? @unique
|
||||
lagoInvoiceIntentReference String?
|
||||
providerPaymentExpiresAt DateTime?
|
||||
providerPaidAt DateTime?
|
||||
invoiceExternalId String?
|
||||
lagoSubscriptionId String?
|
||||
lagoProviderSubscriptionId String?
|
||||
initialLagoInvoiceExternalId String? @unique
|
||||
checkoutUrl String?
|
||||
sourceReference String?
|
||||
failureCode String?
|
||||
providerStartedAt DateTime?
|
||||
reservationExpiresAt DateTime?
|
||||
activatedAt DateTime?
|
||||
failedAt DateTime?
|
||||
cancelledAt DateTime?
|
||||
expiredAt DateTime?
|
||||
refundedAt DateTime?
|
||||
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
||||
subscriptionProduct SubscriptionProduct @relation(fields: [subscriptionProductId], references: [id])
|
||||
subscriptionPrice SubscriptionPrice? @relation(fields: [subscriptionPriceId], references: [id])
|
||||
checkoutSession CheckoutSessionStatus? @relation(fields: [checkoutSessionId], references: [id], onDelete: SetNull)
|
||||
tenantSubscriptionProduct TenantSubscriptionProduct? @relation(fields: [tenantSubscriptionProductId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@unique([tenantId, subscriptionProductId, scopeKey])
|
||||
@@index([tenantId, status, updatedAt])
|
||||
@@index([tenantId, status, reservationExpiresAt])
|
||||
@@index([subscriptionProductId, productKind, status])
|
||||
@@index([invoiceExternalId])
|
||||
@@index([lagoSubscriptionId])
|
||||
@@index([lagoProviderSubscriptionId])
|
||||
}
|
||||
|
||||
model TenantSubscriptionProductPrice {
|
||||
id String @id @default(cuid())
|
||||
tenantSubscriptionProductId String
|
||||
@@ -174,13 +266,16 @@ model TenantSubscriptionUsageRecord {
|
||||
}
|
||||
|
||||
model TenantProductConfiguration {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String @unique
|
||||
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
||||
blueprintId String @default("crm-saas")
|
||||
notes String?
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String @unique
|
||||
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
||||
blueprintId String @default("crm-saas")
|
||||
notes String?
|
||||
signupSubscriptionPriceId String?
|
||||
signupOfficeSeatQuantity Int?
|
||||
signupFieldSeatQuantity Int?
|
||||
}
|
||||
|
||||
model TenantFeatureOverride {
|
||||
@@ -198,14 +293,15 @@ model TenantFeatureOverride {
|
||||
}
|
||||
|
||||
model CheckoutSessionStatus {
|
||||
id String @id
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @unique
|
||||
tenantId String
|
||||
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
||||
pending Boolean @default(true) // has not added products to tenant
|
||||
email String
|
||||
fromUrl String
|
||||
fromUserId String?
|
||||
fromTenantId String?
|
||||
createdUserId String?
|
||||
createdTenantId String?
|
||||
provider String?
|
||||
@@ -215,14 +311,22 @@ model CheckoutSessionStatus {
|
||||
subscriptionPriceId String?
|
||||
lagoSubscriptionId String?
|
||||
planCode String?
|
||||
productKind SubscriptionProductKind @default(base_plan)
|
||||
scopeKey String?
|
||||
quantity Int @default(1)
|
||||
officeSeatQuantity Int @default(0)
|
||||
fieldSeatQuantity Int @default(0)
|
||||
billingCadence String @default("monthly")
|
||||
commitmentEndsAt DateTime?
|
||||
storageAddOnCodes String[] @default([])
|
||||
amountCents Int?
|
||||
currency String?
|
||||
checkoutUrl String?
|
||||
status String @default("open")
|
||||
productAcquisition TenantProductAcquisition?
|
||||
|
||||
@@index([providerPaymentId])
|
||||
@@index([fromTenantId, pending])
|
||||
@@index([tenantId, pending])
|
||||
}
|
||||
|
||||
model BillingWebhookLog {
|
||||
|
||||
Reference in new issue
Block a user