Phase9
This commit is contained in:
@@ -135,6 +135,18 @@ enum DnsRecordStatus {
|
||||
REMOVED
|
||||
}
|
||||
|
||||
enum WhmcsServiceStatus {
|
||||
PENDING
|
||||
ACTIVE
|
||||
SUSPENDED
|
||||
TERMINATED
|
||||
}
|
||||
|
||||
enum IntegrationOperationStatus {
|
||||
COMPLETED
|
||||
FAILED
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
@@ -156,6 +168,7 @@ model User {
|
||||
passwordResetTokens PasswordResetToken[]
|
||||
totpCredential TotpCredential?
|
||||
creditWallet CreditWallet?
|
||||
whmcsClientLink WhmcsClientLink?
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -300,6 +313,8 @@ model GameServer {
|
||||
lastMeteredAt DateTime? @db.Timestamptz(3)
|
||||
joinSlug String? @unique
|
||||
joinToStartEnabled Boolean @default(true)
|
||||
billingSuspendedAt DateTime? @db.Timestamptz(3)
|
||||
billingSuspendReason String?
|
||||
createdAt DateTime @default(now()) @db.Timestamptz(3)
|
||||
updatedAt DateTime @updatedAt @db.Timestamptz(3)
|
||||
|
||||
@@ -316,6 +331,7 @@ model GameServer {
|
||||
startQueueEntry ServerStartQueueEntry?
|
||||
usageRecords UsageRecord[]
|
||||
dnsRecords ServerDnsRecord[]
|
||||
whmcsServiceLink WhmcsServiceLink?
|
||||
|
||||
@@index([userId])
|
||||
@@index([nodeId])
|
||||
@@ -684,3 +700,73 @@ model ServerDnsRecord {
|
||||
@@index([fqdn])
|
||||
@@map("server_dns_records")
|
||||
}
|
||||
|
||||
model WhmcsInstallation {
|
||||
id String @id @default(uuid())
|
||||
integrationId String @unique
|
||||
name String
|
||||
apiSecret String
|
||||
isActive Boolean @default(true)
|
||||
metadata Json?
|
||||
createdAt DateTime @default(now()) @db.Timestamptz(3)
|
||||
updatedAt DateTime @updatedAt @db.Timestamptz(3)
|
||||
|
||||
clientLinks WhmcsClientLink[]
|
||||
serviceLinks WhmcsServiceLink[]
|
||||
operations IntegrationOperation[]
|
||||
|
||||
@@map("whmcs_installations")
|
||||
}
|
||||
|
||||
model WhmcsClientLink {
|
||||
id String @id @default(uuid())
|
||||
installationId String
|
||||
externalClientId String
|
||||
userId String @unique
|
||||
createdAt DateTime @default(now()) @db.Timestamptz(3)
|
||||
updatedAt DateTime @updatedAt @db.Timestamptz(3)
|
||||
|
||||
installation WhmcsInstallation @relation(fields: [installationId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([installationId, externalClientId])
|
||||
@@map("whmcs_client_links")
|
||||
}
|
||||
|
||||
model WhmcsServiceLink {
|
||||
id String @id @default(uuid())
|
||||
installationId String
|
||||
externalServiceId String
|
||||
serverId String @unique
|
||||
externalProductId String?
|
||||
status WhmcsServiceStatus @default(PENDING)
|
||||
suspendedAt DateTime? @db.Timestamptz(3)
|
||||
terminatedAt DateTime? @db.Timestamptz(3)
|
||||
metadata Json?
|
||||
createdAt DateTime @default(now()) @db.Timestamptz(3)
|
||||
updatedAt DateTime @updatedAt @db.Timestamptz(3)
|
||||
|
||||
installation WhmcsInstallation @relation(fields: [installationId], references: [id], onDelete: Cascade)
|
||||
server GameServer @relation(fields: [serverId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([installationId, externalServiceId])
|
||||
@@index([installationId, status])
|
||||
@@map("whmcs_service_links")
|
||||
}
|
||||
|
||||
model IntegrationOperation {
|
||||
id String @id @default(uuid())
|
||||
installationId String
|
||||
idempotencyKey String @unique
|
||||
operation String
|
||||
externalRef String?
|
||||
status IntegrationOperationStatus @default(COMPLETED)
|
||||
result Json?
|
||||
error String?
|
||||
createdAt DateTime @default(now()) @db.Timestamptz(3)
|
||||
|
||||
installation WhmcsInstallation @relation(fields: [installationId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([installationId, createdAt])
|
||||
@@map("integration_operations")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user