Add support subscription panel API with optional free periods.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -74,6 +74,7 @@ model Tenant {
|
||||
/// 0..N hosting/billing servers per sold version (not the same as nodeServer API URL)
|
||||
serverAccounts ServerAccount[]
|
||||
pluginSubscriptions PluginSubscription[]
|
||||
supportSubscriptions SupportSubscription[]
|
||||
|
||||
@@index([product])
|
||||
@@index([isActive])
|
||||
@@ -279,3 +280,53 @@ model PluginCharge {
|
||||
@@index([createdAt])
|
||||
@@map("plugin_charges")
|
||||
}
|
||||
|
||||
/// Support/maintenance subscription for a sold version (0..N per tenant).
|
||||
/// Can be free (isFree) for 1|3|6|12 months gift periods.
|
||||
model SupportSubscription {
|
||||
id String @id @default(cuid())
|
||||
tenantId String @map("tenant_id")
|
||||
name String
|
||||
specs String?
|
||||
priceRials Int? @map("price_rials")
|
||||
/// When true, current period is complimentary (price should be 0)
|
||||
isFree Boolean @default(false) @map("is_free")
|
||||
chargedAt DateTime? @map("charged_at")
|
||||
/// Plan length in months: 1 | 3 | 6 | 12
|
||||
planMonths Int? @map("plan_months")
|
||||
expiresAt DateTime? @map("expires_at")
|
||||
description String?
|
||||
alertDaysBefore Int @default(3) @map("alert_days_before")
|
||||
lastAlertDate DateTime? @map("last_alert_date")
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
||||
charges SupportCharge[]
|
||||
|
||||
@@index([tenantId])
|
||||
@@index([expiresAt])
|
||||
@@index([isActive])
|
||||
@@index([isFree])
|
||||
@@map("support_subscriptions")
|
||||
}
|
||||
|
||||
model SupportCharge {
|
||||
id String @id @default(cuid())
|
||||
supportId String @map("support_id")
|
||||
chargedAt DateTime @map("charged_at")
|
||||
planMonths Int @map("plan_months")
|
||||
priceRials Int @map("price_rials")
|
||||
isFree Boolean @default(false) @map("is_free")
|
||||
expiresAt DateTime @map("expires_at")
|
||||
note String?
|
||||
createdById String? @map("created_by_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
support SupportSubscription @relation(fields: [supportId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([supportId])
|
||||
@@index([createdAt])
|
||||
@@map("support_charges")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user