mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-23 19:27:25 +02:00
✨ Add licensing api (#1723)
This commit is contained in:
parent
982fc39ac7
commit
679d6fb034
14 changed files with 607 additions and 40 deletions
56
packages/database/prisma/models/licensing.prisma
Normal file
56
packages/database/prisma/models/licensing.prisma
Normal file
|
@ -0,0 +1,56 @@
|
|||
enum LicenseType {
|
||||
PLUS
|
||||
ORGANIZATION
|
||||
ENTERPRISE
|
||||
}
|
||||
|
||||
enum LicenseStatus {
|
||||
ACTIVE
|
||||
REVOKED
|
||||
}
|
||||
|
||||
model License {
|
||||
id String @id @default(cuid())
|
||||
licenseKey String @unique @map("license_key")
|
||||
version Int? @map("version")
|
||||
type LicenseType
|
||||
seats Int? @map("seats")
|
||||
issuedAt DateTime @default(now()) @map("issued_at")
|
||||
expiresAt DateTime? @map("expires_at")
|
||||
licenseeEmail String? @map("licensee_email")
|
||||
licenseeName String? @map("licensee_name")
|
||||
status LicenseStatus @default(ACTIVE) @map("status")
|
||||
stripeCustomerId String? @map("stripe_customer_id")
|
||||
|
||||
validations LicenseValidation[]
|
||||
|
||||
@@map("licenses")
|
||||
}
|
||||
|
||||
model LicenseValidation {
|
||||
id String @id @default(cuid())
|
||||
licenseId String @map("license_id")
|
||||
license License @relation(fields: [licenseId], references: [id], onDelete: Cascade)
|
||||
ipAddress String? @map("ip_address")
|
||||
fingerprint String? @map("fingerprint")
|
||||
validatedAt DateTime @default(now()) @map("validated_at")
|
||||
userAgent String? @map("user_agent")
|
||||
|
||||
@@map("license_validations")
|
||||
}
|
||||
|
||||
|
||||
model InstanceLicense {
|
||||
id String @id @default(cuid())
|
||||
licenseKey String @unique @map("license_key")
|
||||
version Int? @map("version")
|
||||
type LicenseType
|
||||
seats Int? @map("seats")
|
||||
issuedAt DateTime @default(now()) @map("issued_at")
|
||||
expiresAt DateTime? @map("expires_at")
|
||||
licenseeEmail String? @map("licensee_email")
|
||||
licenseeName String? @map("licensee_name")
|
||||
status LicenseStatus @default(ACTIVE) @map("status")
|
||||
|
||||
@@map("instance_licenses")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue