mirror of
https://github.com/documenso/documenso.git
synced 2025-11-23 05:01:54 +10:00
feat: billing
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
// Todo: orgs remember to add custom migration to apply default claims
|
||||
generator kysely {
|
||||
provider = "prisma-kysely"
|
||||
}
|
||||
@ -39,7 +40,6 @@ enum Role {
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
name String?
|
||||
customerId String? @unique
|
||||
email String @unique
|
||||
emailVerified DateTime?
|
||||
password String? // Todo: (RR7) Remove after RR7 migration.
|
||||
@ -60,8 +60,6 @@ model User {
|
||||
ownedOrganisations Organisation[]
|
||||
organisationMember OrganisationMember[]
|
||||
|
||||
ownedPendingTeams TeamPending[]
|
||||
|
||||
twoFactorSecret String?
|
||||
twoFactorEnabled Boolean @default(false)
|
||||
twoFactorBackupCodes String?
|
||||
@ -255,12 +253,44 @@ model Subscription {
|
||||
updatedAt DateTime @updatedAt
|
||||
cancelAtPeriodEnd Boolean @default(false)
|
||||
|
||||
organisationId String
|
||||
organisation Organisation @relation(fields: [organisationId], references: [id])
|
||||
customerId String? // Todo: orgs
|
||||
|
||||
organisationId String @unique
|
||||
organisation Organisation @relation(fields: [organisationId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([organisationId])
|
||||
}
|
||||
|
||||
/// @zod.import(["import { ZClaimFlagsSchema } from '@documenso/lib/types/subscription';"])
|
||||
model SubscriptionClaim {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
name String
|
||||
locked Boolean @default(false)
|
||||
|
||||
teamCount Int
|
||||
memberCount Int
|
||||
|
||||
flags Json /// [ClaimFlags] @zod.custom.use(ZClaimFlagsSchema)
|
||||
}
|
||||
|
||||
/// @zod.import(["import { ZClaimFlagsSchema } from '@documenso/lib/types/subscription';"])
|
||||
model OrganisationClaim {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
originalSubscriptionClaimId String?
|
||||
organisation Organisation?
|
||||
|
||||
teamCount Int
|
||||
memberCount Int
|
||||
|
||||
flags Json /// [ClaimFlags] @zod.custom.use(ZClaimFlagsSchema)
|
||||
}
|
||||
|
||||
model Account {
|
||||
id String @id @default(cuid())
|
||||
userId Int
|
||||
@ -550,8 +580,11 @@ model Organisation {
|
||||
url String @unique // todo: constrain
|
||||
avatarImageId String?
|
||||
|
||||
customerId String? @unique
|
||||
subscriptions Subscription[]
|
||||
customerId String? @unique // Todo: orgs
|
||||
subscription Subscription?
|
||||
|
||||
organisationClaimId String @unique
|
||||
organisationClaim OrganisationClaim @relation(fields: [organisationClaimId], references: [id], onDelete: Cascade)
|
||||
|
||||
members OrganisationMember[]
|
||||
invites OrganisationMemberInvite[]
|
||||
@ -683,7 +716,7 @@ model OrganisationGlobalSettings {
|
||||
brandingLogo String @default("")
|
||||
brandingUrl String @default("")
|
||||
brandingCompanyDetails String @default("")
|
||||
brandingHidePoweredBy Boolean @default(false)
|
||||
brandingHidePoweredBy Boolean @default(false) // Todo: orgs this doesn't seem to be used?
|
||||
}
|
||||
|
||||
model TeamGlobalSettings {
|
||||
@ -732,17 +765,6 @@ model Team {
|
||||
teamGlobalSettings TeamGlobalSettings @relation(fields: [teamGlobalSettingsId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model TeamPending {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
url String @unique
|
||||
createdAt DateTime @default(now())
|
||||
customerId String @unique
|
||||
ownerUserId Int
|
||||
|
||||
owner User @relation(fields: [ownerUserId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model TeamEmail {
|
||||
teamId Int @id @unique
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
Reference in New Issue
Block a user