2
0

feat: Add collaboration

This commit is contained in:
Baptiste Arnaud
2022-02-24 11:13:19 +01:00
parent dd671a5d2c
commit b9dafa611e
63 changed files with 1932 additions and 148 deletions

View File

@ -38,20 +38,21 @@ model Session {
}
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
typebots Typebot[]
folders DashboardFolder[]
plan Plan @default(FREE)
stripeId String? @unique
credentials Credentials[]
customDomains CustomDomain[]
apiToken String?
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
typebots Typebot[]
folders DashboardFolder[]
plan Plan @default(FREE)
stripeId String? @unique
credentials Credentials[]
customDomains CustomDomain[]
apiToken String?
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
}
model CustomDomain {
@ -103,28 +104,54 @@ model DashboardFolder {
}
model Typebot {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
name String
ownerId String
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
publishedTypebotId String?
publishedTypebot PublicTypebot?
results Result[]
folderId String?
folder DashboardFolder? @relation(fields: [folderId], references: [id])
folder DashboardFolder? @relation(fields: [folderId], references: [id])
blocks Json[]
variables Json[]
edges Json[]
theme Json
settings Json
publicId String? @unique
customDomain String? @unique
publicId String? @unique
customDomain String? @unique
collaborators CollaboratorsOnTypebots[]
invitations Invitation[]
@@unique([id, ownerId])
}
model Invitation {
email String
typebotId String
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
type CollaborationType
@@unique([email, typebotId])
}
model CollaboratorsOnTypebots {
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
typebotId String
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
type CollaborationType
@@unique([userId, typebotId])
}
enum CollaborationType {
READ
WRITE
}
model PublicTypebot {
id String @id @default(cuid())
createdAt DateTime @default(now())