2021-03-22 13:48:48 +00:00
|
|
|
// This is your Prisma schema file,
|
|
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
generator client {
|
2022-04-06 12:37:06 +00:00
|
|
|
provider = "prisma-client-js"
|
2023-01-26 22:51:03 +00:00
|
|
|
previewFeatures = []
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
2022-01-21 21:35:31 +00:00
|
|
|
generator zod {
|
|
|
|
provider = "zod-prisma"
|
|
|
|
output = "./zod"
|
|
|
|
imports = "./zod-utils"
|
|
|
|
relationModel = "default"
|
|
|
|
}
|
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
enum SchedulingType {
|
2022-07-22 17:27:06 +00:00
|
|
|
ROUND_ROBIN @map("roundRobin")
|
|
|
|
COLLECTIVE @map("collective")
|
2021-09-14 08:45:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-18 01:03:19 +00:00
|
|
|
enum PeriodType {
|
2022-07-22 17:27:06 +00:00
|
|
|
UNLIMITED @map("unlimited")
|
|
|
|
ROLLING @map("rolling")
|
|
|
|
RANGE @map("range")
|
2021-11-18 01:03:19 +00:00
|
|
|
}
|
|
|
|
|
2023-01-12 21:09:12 +00:00
|
|
|
model Host {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
userId Int
|
|
|
|
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
|
|
|
eventTypeId Int
|
|
|
|
isFixed Boolean @default(false)
|
|
|
|
}
|
|
|
|
|
2021-03-22 13:48:48 +00:00
|
|
|
model EventType {
|
2022-07-14 00:10:45 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2022-10-11 00:28:24 +00:00
|
|
|
/// @zod.min(1)
|
2021-09-02 12:13:19 +00:00
|
|
|
title String
|
2022-01-21 21:35:31 +00:00
|
|
|
/// @zod.custom(imports.eventTypeSlug)
|
2021-09-02 12:13:19 +00:00
|
|
|
slug String
|
|
|
|
description String?
|
2022-07-14 00:10:45 +00:00
|
|
|
position Int @default(0)
|
2022-01-21 21:35:31 +00:00
|
|
|
/// @zod.custom(imports.eventTypeLocations)
|
2021-09-02 12:13:19 +00:00
|
|
|
locations Json?
|
|
|
|
length Int
|
2022-07-14 00:10:45 +00:00
|
|
|
hidden Boolean @default(false)
|
2023-01-12 21:09:12 +00:00
|
|
|
hosts Host[]
|
2022-07-14 00:10:45 +00:00
|
|
|
users User[] @relation("user_eventtype")
|
2022-07-20 18:49:53 +00:00
|
|
|
owner User? @relation("owner", fields: [userId], references: [id], onDelete: Cascade)
|
2021-09-02 12:13:19 +00:00
|
|
|
userId Int?
|
2022-07-20 18:49:53 +00:00
|
|
|
team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
2021-09-14 08:45:28 +00:00
|
|
|
teamId Int?
|
2022-04-28 15:44:26 +00:00
|
|
|
hashedLink HashedLink?
|
2021-09-02 12:13:19 +00:00
|
|
|
bookings Booking[]
|
|
|
|
availability Availability[]
|
2022-03-02 16:24:57 +00:00
|
|
|
webhooks Webhook[]
|
2022-01-21 21:35:31 +00:00
|
|
|
destinationCalendar DestinationCalendar?
|
2021-09-02 12:13:19 +00:00
|
|
|
eventName String?
|
|
|
|
customInputs EventTypeCustomInput[]
|
2023-03-02 18:15:28 +00:00
|
|
|
/// @zod.custom(imports.eventTypeBookingFields)
|
|
|
|
bookingFields Json?
|
2021-09-02 12:13:19 +00:00
|
|
|
timeZone String?
|
2022-07-14 00:10:45 +00:00
|
|
|
periodType PeriodType @default(UNLIMITED)
|
2021-09-02 12:13:19 +00:00
|
|
|
periodStartDate DateTime?
|
|
|
|
periodEndDate DateTime?
|
|
|
|
periodDays Int?
|
2021-07-15 14:10:26 +00:00
|
|
|
periodCountCalendarDays Boolean?
|
2022-07-14 00:10:45 +00:00
|
|
|
requiresConfirmation Boolean @default(false)
|
2022-06-10 00:32:34 +00:00
|
|
|
/// @zod.custom(imports.recurringEventType)
|
2022-05-05 21:16:25 +00:00
|
|
|
recurringEvent Json?
|
2022-07-14 00:10:45 +00:00
|
|
|
disableGuests Boolean @default(false)
|
|
|
|
hideCalendarNotes Boolean @default(false)
|
|
|
|
minimumBookingNotice Int @default(120)
|
|
|
|
beforeEventBuffer Int @default(0)
|
|
|
|
afterEventBuffer Int @default(0)
|
2022-05-24 13:19:12 +00:00
|
|
|
seatsPerTimeSlot Int?
|
2022-12-19 14:12:18 +00:00
|
|
|
seatsShowAttendees Boolean? @default(false)
|
2021-09-14 08:45:28 +00:00
|
|
|
schedulingType SchedulingType?
|
2022-07-14 00:10:45 +00:00
|
|
|
schedule Schedule? @relation(fields: [scheduleId], references: [id])
|
2022-06-22 15:43:25 +00:00
|
|
|
scheduleId Int?
|
2022-10-14 16:24:43 +00:00
|
|
|
// price is deprecated. It has now moved to metadata.apps.stripe.price. Plan to drop this column.
|
2022-07-14 00:10:45 +00:00
|
|
|
price Int @default(0)
|
2022-10-14 16:24:43 +00:00
|
|
|
// currency is deprecated. It has now moved to metadata.apps.stripe.currency. Plan to drop this column.
|
2022-07-14 00:10:45 +00:00
|
|
|
currency String @default("usd")
|
2021-12-19 12:11:31 +00:00
|
|
|
slotInterval Int?
|
2022-10-14 16:24:43 +00:00
|
|
|
/// @zod.custom(imports.EventTypeMetaDataSchema)
|
2022-02-01 21:48:40 +00:00
|
|
|
metadata Json?
|
2022-08-01 21:44:08 +00:00
|
|
|
/// @zod.custom(imports.successRedirectUrl)
|
2022-04-05 08:05:40 +00:00
|
|
|
successRedirectUrl String?
|
2022-07-14 00:10:45 +00:00
|
|
|
workflows WorkflowsOnEventTypes[]
|
2022-10-12 05:29:04 +00:00
|
|
|
/// @zod.custom(imports.bookingLimitsType)
|
|
|
|
bookingLimits Json?
|
2021-10-29 14:13:51 +00:00
|
|
|
|
2021-09-22 18:36:13 +00:00
|
|
|
@@unique([userId, slug])
|
2022-04-20 00:35:12 +00:00
|
|
|
@@unique([teamId, slug])
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Credential {
|
2022-07-06 22:55:29 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2022-08-22 19:34:28 +00:00
|
|
|
// @@type is deprecated
|
2022-07-06 22:55:29 +00:00
|
|
|
type String
|
|
|
|
key Json
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
userId Int?
|
|
|
|
app App? @relation(fields: [appId], references: [slug], onDelete: Cascade)
|
2022-06-07 06:13:32 +00:00
|
|
|
// How to make it a required column?
|
2022-07-06 22:55:29 +00:00
|
|
|
appId String?
|
2022-07-01 20:55:27 +00:00
|
|
|
destinationCalendars DestinationCalendar[]
|
2022-12-07 21:47:02 +00:00
|
|
|
invalid Boolean? @default(false)
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
2022-01-13 20:05:23 +00:00
|
|
|
enum IdentityProvider {
|
|
|
|
CAL
|
|
|
|
GOOGLE
|
|
|
|
SAML
|
|
|
|
}
|
|
|
|
|
2021-12-09 15:51:37 +00:00
|
|
|
model DestinationCalendar {
|
2022-07-06 22:55:29 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
integration String
|
|
|
|
externalId String
|
2022-08-22 19:34:28 +00:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2022-07-06 22:55:29 +00:00
|
|
|
userId Int? @unique
|
2022-07-18 15:37:47 +00:00
|
|
|
booking Booking[]
|
2022-08-22 19:34:28 +00:00
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
2022-07-06 22:55:29 +00:00
|
|
|
eventTypeId Int? @unique
|
2022-07-01 20:55:27 +00:00
|
|
|
credentialId Int?
|
2022-08-22 19:34:28 +00:00
|
|
|
credential Credential? @relation(fields: [credentialId], references: [id], onDelete: Cascade)
|
2021-12-09 15:51:37 +00:00
|
|
|
}
|
|
|
|
|
2022-04-26 08:48:17 +00:00
|
|
|
enum UserPermissionRole {
|
|
|
|
USER
|
|
|
|
ADMIN
|
|
|
|
}
|
|
|
|
|
2021-03-22 13:48:48 +00:00
|
|
|
model User {
|
2022-07-14 12:40:53 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
username String? @unique
|
2022-05-25 15:21:18 +00:00
|
|
|
name String?
|
2022-01-21 21:35:31 +00:00
|
|
|
/// @zod.email()
|
2022-07-14 12:40:53 +00:00
|
|
|
email String @unique
|
2022-05-25 15:21:18 +00:00
|
|
|
emailVerified DateTime?
|
|
|
|
password String?
|
|
|
|
bio String?
|
|
|
|
avatar String?
|
2022-07-14 12:40:53 +00:00
|
|
|
timeZone String @default("Europe/London")
|
|
|
|
weekStart String @default("Sunday")
|
2021-12-08 12:08:57 +00:00
|
|
|
// DEPRECATED - TO BE REMOVED
|
2022-07-14 12:40:53 +00:00
|
|
|
startTime Int @default(0)
|
|
|
|
endTime Int @default(1440)
|
2021-12-08 12:08:57 +00:00
|
|
|
// </DEPRECATED>
|
2022-07-14 12:40:53 +00:00
|
|
|
bufferTime Int @default(0)
|
|
|
|
hideBranding Boolean @default(false)
|
2022-05-25 15:21:18 +00:00
|
|
|
theme String?
|
2022-07-14 12:40:53 +00:00
|
|
|
createdDate DateTime @default(now()) @map(name: "created")
|
2022-05-25 15:21:18 +00:00
|
|
|
trialEndsAt DateTime?
|
2022-07-14 12:40:53 +00:00
|
|
|
eventTypes EventType[] @relation("user_eventtype")
|
2022-05-25 15:21:18 +00:00
|
|
|
credentials Credential[]
|
|
|
|
teams Membership[]
|
|
|
|
bookings Booking[]
|
|
|
|
schedules Schedule[]
|
|
|
|
defaultScheduleId Int?
|
|
|
|
selectedCalendars SelectedCalendar[]
|
2022-07-14 12:40:53 +00:00
|
|
|
completedOnboarding Boolean @default(false)
|
2022-05-25 15:21:18 +00:00
|
|
|
locale String?
|
2022-07-14 12:40:53 +00:00
|
|
|
timeFormat Int? @default(12)
|
2022-05-25 15:21:18 +00:00
|
|
|
twoFactorSecret String?
|
2022-07-14 12:40:53 +00:00
|
|
|
twoFactorEnabled Boolean @default(false)
|
|
|
|
identityProvider IdentityProvider @default(CAL)
|
2022-05-25 15:21:18 +00:00
|
|
|
identityProviderId String?
|
|
|
|
availability Availability[]
|
|
|
|
invitedTo Int?
|
|
|
|
webhooks Webhook[]
|
2022-07-14 12:40:53 +00:00
|
|
|
brandColor String @default("#292929")
|
|
|
|
darkBrandColor String @default("#fafafa")
|
2021-12-09 15:51:37 +00:00
|
|
|
// the location where the events will end up
|
2022-05-25 15:21:18 +00:00
|
|
|
destinationCalendar DestinationCalendar?
|
2022-07-14 12:40:53 +00:00
|
|
|
away Boolean @default(false)
|
2022-04-06 17:20:30 +00:00
|
|
|
// participate in dynamic group booking or not
|
2022-07-14 12:40:53 +00:00
|
|
|
allowDynamicBooking Boolean? @default(true)
|
2022-06-14 20:07:54 +00:00
|
|
|
/// @zod.custom(imports.userMetadata)
|
2022-05-25 15:21:18 +00:00
|
|
|
metadata Json?
|
2022-07-14 12:40:53 +00:00
|
|
|
verified Boolean? @default(false)
|
|
|
|
role UserPermissionRole @default(USER)
|
|
|
|
disableImpersonation Boolean @default(false)
|
|
|
|
impersonatedUsers Impersonations[] @relation("impersonated_user")
|
|
|
|
impersonatedBy Impersonations[] @relation("impersonated_by_user")
|
2022-05-25 15:21:18 +00:00
|
|
|
apiKeys ApiKey[]
|
|
|
|
accounts Account[]
|
|
|
|
sessions Session[]
|
2022-07-20 18:49:53 +00:00
|
|
|
Feedback Feedback[]
|
|
|
|
ownedEventTypes EventType[] @relation("owner")
|
2022-07-14 00:10:45 +00:00
|
|
|
workflows Workflow[]
|
2022-07-14 12:40:53 +00:00
|
|
|
routingForms App_RoutingForms_Form[] @relation("routing-form")
|
2022-12-15 21:54:40 +00:00
|
|
|
verifiedNumbers VerifiedNumber[]
|
2023-01-12 21:09:12 +00:00
|
|
|
hosts Host[]
|
2022-07-14 12:40:53 +00:00
|
|
|
|
2021-03-22 13:48:48 +00:00
|
|
|
@@map(name: "users")
|
2021-06-05 22:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Team {
|
2023-02-27 07:24:43 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2022-10-11 00:28:24 +00:00
|
|
|
/// @zod.min(1)
|
2023-01-06 10:55:57 +00:00
|
|
|
name String
|
2022-10-11 00:28:24 +00:00
|
|
|
/// @zod.min(1)
|
2023-02-27 07:24:43 +00:00
|
|
|
slug String? @unique
|
2023-01-06 10:55:57 +00:00
|
|
|
logo String?
|
|
|
|
bio String?
|
2023-02-27 07:24:43 +00:00
|
|
|
hideBranding Boolean @default(false)
|
|
|
|
hideBookATeamMember Boolean @default(false)
|
2023-01-06 10:55:57 +00:00
|
|
|
members Membership[]
|
|
|
|
eventTypes EventType[]
|
2023-02-27 07:24:43 +00:00
|
|
|
workflows Workflow[]
|
|
|
|
createdAt DateTime @default(now())
|
2022-11-10 20:23:56 +00:00
|
|
|
/// @zod.custom(imports.teamMetadataSchema)
|
2023-01-06 10:55:57 +00:00
|
|
|
metadata Json?
|
2023-02-01 18:27:26 +00:00
|
|
|
theme String?
|
2023-02-27 07:24:43 +00:00
|
|
|
brandColor String @default("#292929")
|
|
|
|
darkBrandColor String @default("#fafafa")
|
|
|
|
verifiedNumbers VerifiedNumber[]
|
2021-06-05 22:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum MembershipRole {
|
|
|
|
MEMBER
|
2021-12-09 23:51:30 +00:00
|
|
|
ADMIN
|
2021-06-05 22:53:33 +00:00
|
|
|
OWNER
|
|
|
|
}
|
|
|
|
|
|
|
|
model Membership {
|
2022-07-21 17:02:20 +00:00
|
|
|
teamId Int
|
|
|
|
userId Int
|
|
|
|
accepted Boolean @default(false)
|
|
|
|
role MembershipRole
|
2022-10-11 01:24:46 +00:00
|
|
|
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
2022-07-21 17:02:20 +00:00
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
disableImpersonation Boolean @default(false)
|
2021-06-05 22:53:33 +00:00
|
|
|
|
2021-09-02 12:13:19 +00:00
|
|
|
@@id([userId, teamId])
|
2021-06-09 21:29:31 +00:00
|
|
|
}
|
|
|
|
|
2022-04-21 20:32:25 +00:00
|
|
|
model VerificationToken {
|
2021-09-02 12:13:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2021-06-09 21:29:31 +00:00
|
|
|
identifier String
|
|
|
|
token String @unique
|
|
|
|
expires DateTime
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
2021-09-02 12:13:19 +00:00
|
|
|
|
2021-06-09 21:29:31 +00:00
|
|
|
@@unique([identifier, token])
|
2021-06-11 21:02:07 +00:00
|
|
|
}
|
|
|
|
|
2021-06-05 23:31:03 +00:00
|
|
|
model BookingReference {
|
2022-05-17 19:31:49 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2022-10-11 03:33:38 +00:00
|
|
|
/// @zod.min(1)
|
2022-05-17 19:31:49 +00:00
|
|
|
type String
|
2022-10-11 03:33:38 +00:00
|
|
|
/// @zod.min(1)
|
2022-05-17 19:31:49 +00:00
|
|
|
uid String
|
|
|
|
meetingId String?
|
|
|
|
meetingPassword String?
|
|
|
|
meetingUrl String?
|
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
|
|
|
bookingId Int?
|
2022-05-16 20:20:09 +00:00
|
|
|
externalCalendarId String?
|
2022-05-17 19:31:49 +00:00
|
|
|
deleted Boolean?
|
2022-07-18 15:37:47 +00:00
|
|
|
credentialId Int?
|
2021-06-05 23:31:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Attendee {
|
2021-09-02 12:13:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
email String
|
|
|
|
name String
|
|
|
|
timeZone String
|
2022-01-27 20:32:53 +00:00
|
|
|
locale String? @default("en")
|
2021-09-02 12:13:19 +00:00
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
|
|
|
bookingId Int?
|
2021-06-05 23:31:03 +00:00
|
|
|
}
|
|
|
|
|
2021-09-13 08:57:56 +00:00
|
|
|
enum BookingStatus {
|
2022-07-22 17:27:06 +00:00
|
|
|
CANCELLED @map("cancelled")
|
|
|
|
ACCEPTED @map("accepted")
|
|
|
|
REJECTED @map("rejected")
|
|
|
|
PENDING @map("pending")
|
2021-09-13 08:57:56 +00:00
|
|
|
}
|
|
|
|
|
2021-06-05 23:31:03 +00:00
|
|
|
model Booking {
|
2022-07-18 15:37:47 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
uid String @unique
|
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
userId Int?
|
|
|
|
references BookingReference[]
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
|
|
|
eventTypeId Int?
|
|
|
|
title String
|
|
|
|
description String?
|
|
|
|
customInputs Json?
|
2023-03-02 18:15:28 +00:00
|
|
|
/// @zod.custom(imports.bookingResponses)
|
|
|
|
responses Json?
|
2022-07-18 15:37:47 +00:00
|
|
|
startTime DateTime
|
|
|
|
endTime DateTime
|
|
|
|
attendees Attendee[]
|
|
|
|
location String?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime?
|
|
|
|
status BookingStatus @default(ACCEPTED)
|
|
|
|
paid Boolean @default(false)
|
|
|
|
payment Payment[]
|
|
|
|
destinationCalendar DestinationCalendar? @relation(fields: [destinationCalendarId], references: [id])
|
|
|
|
destinationCalendarId Int?
|
|
|
|
cancellationReason String?
|
|
|
|
rejectionReason String?
|
|
|
|
dynamicEventSlugRef String?
|
|
|
|
dynamicGroupSlugRef String?
|
|
|
|
rescheduled Boolean?
|
|
|
|
fromReschedule String?
|
|
|
|
recurringEventId String?
|
|
|
|
smsReminderNumber String?
|
|
|
|
workflowReminders WorkflowReminder[]
|
2022-08-15 20:18:41 +00:00
|
|
|
scheduledJobs String[]
|
2022-12-15 21:43:07 +00:00
|
|
|
/// @zod.custom(imports.bookingMetadataSchema)
|
|
|
|
metadata Json?
|
2021-09-02 12:13:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Schedule {
|
2022-03-17 16:48:23 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
userId Int
|
2022-06-22 15:43:25 +00:00
|
|
|
eventType EventType[]
|
2022-03-17 16:48:23 +00:00
|
|
|
name String
|
|
|
|
timeZone String?
|
|
|
|
availability Availability[]
|
2023-01-05 22:29:03 +00:00
|
|
|
|
|
|
|
@@index([userId])
|
2021-06-14 18:53:20 +00:00
|
|
|
}
|
|
|
|
|
2021-06-28 04:24:15 +00:00
|
|
|
model Availability {
|
2021-09-02 12:13:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2022-01-14 13:49:15 +00:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-09-02 12:13:19 +00:00
|
|
|
userId Int?
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
|
|
|
eventTypeId Int?
|
|
|
|
days Int[]
|
2021-11-10 11:16:32 +00:00
|
|
|
startTime DateTime @db.Time
|
|
|
|
endTime DateTime @db.Time
|
2021-09-02 12:13:19 +00:00
|
|
|
date DateTime? @db.Date
|
2022-03-17 16:48:23 +00:00
|
|
|
Schedule Schedule? @relation(fields: [scheduleId], references: [id])
|
|
|
|
scheduleId Int?
|
2023-01-05 22:29:03 +00:00
|
|
|
|
|
|
|
@@index([eventTypeId])
|
|
|
|
@@index([scheduleId])
|
2021-06-14 18:53:20 +00:00
|
|
|
}
|
2021-06-20 17:52:18 +00:00
|
|
|
|
2021-06-14 17:45:24 +00:00
|
|
|
model SelectedCalendar {
|
2022-01-14 13:49:15 +00:00
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-09-02 12:13:19 +00:00
|
|
|
userId Int
|
|
|
|
integration String
|
|
|
|
externalId String
|
|
|
|
|
|
|
|
@@id([userId, integration, externalId])
|
2021-06-14 17:45:24 +00:00
|
|
|
}
|
2021-06-19 18:55:40 +00:00
|
|
|
|
2021-08-14 17:03:50 +00:00
|
|
|
enum EventTypeCustomInputType {
|
2022-07-22 17:27:06 +00:00
|
|
|
TEXT @map("text")
|
|
|
|
TEXTLONG @map("textLong")
|
|
|
|
NUMBER @map("number")
|
|
|
|
BOOL @map("bool")
|
2022-12-01 21:53:52 +00:00
|
|
|
RADIO @map("radio")
|
2022-12-16 19:39:41 +00:00
|
|
|
PHONE @map("phone")
|
2021-08-14 17:03:50 +00:00
|
|
|
}
|
|
|
|
|
2021-06-19 18:55:40 +00:00
|
|
|
model EventTypeCustomInput {
|
2021-09-02 12:13:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2021-06-19 18:55:40 +00:00
|
|
|
eventTypeId Int
|
2022-07-20 18:49:53 +00:00
|
|
|
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
2021-06-19 18:55:40 +00:00
|
|
|
label String
|
2021-08-14 17:03:50 +00:00
|
|
|
type EventTypeCustomInputType
|
2023-01-07 17:17:32 +00:00
|
|
|
/// @zod.custom(imports.customInputOptionSchema)
|
2022-12-01 21:53:52 +00:00
|
|
|
options Json?
|
2021-06-19 18:55:40 +00:00
|
|
|
required Boolean
|
2021-09-06 13:51:15 +00:00
|
|
|
placeholder String @default("")
|
2021-06-19 18:55:40 +00:00
|
|
|
}
|
|
|
|
|
2021-06-30 02:01:29 +00:00
|
|
|
model ResetPasswordRequest {
|
2021-09-02 12:13:19 +00:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
email String
|
|
|
|
expires DateTime
|
2021-06-30 02:01:29 +00:00
|
|
|
}
|
2021-07-18 19:12:35 +00:00
|
|
|
|
|
|
|
enum ReminderType {
|
|
|
|
PENDING_BOOKING_CONFIRMATION
|
|
|
|
}
|
|
|
|
|
|
|
|
model ReminderMail {
|
2021-09-02 12:13:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2021-07-18 19:12:35 +00:00
|
|
|
referenceId Int
|
|
|
|
reminderType ReminderType
|
|
|
|
elapsedMinutes Int
|
2021-09-02 12:13:19 +00:00
|
|
|
createdAt DateTime @default(now())
|
2021-07-18 19:12:35 +00:00
|
|
|
}
|
2021-09-22 18:36:13 +00:00
|
|
|
|
|
|
|
model Payment {
|
2023-02-08 20:36:22 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
uid String @unique
|
|
|
|
app App? @relation(fields: [appId], references: [slug], onDelete: Cascade)
|
|
|
|
appId String?
|
2021-10-29 14:13:51 +00:00
|
|
|
bookingId Int
|
2023-02-08 20:36:22 +00:00
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
2021-10-29 14:13:51 +00:00
|
|
|
amount Int
|
|
|
|
fee Int
|
|
|
|
currency String
|
|
|
|
success Boolean
|
|
|
|
refunded Boolean
|
|
|
|
data Json
|
2023-02-08 20:36:22 +00:00
|
|
|
externalId String @unique
|
2021-09-22 18:36:13 +00:00
|
|
|
}
|
2021-10-07 15:14:47 +00:00
|
|
|
|
|
|
|
enum WebhookTriggerEvents {
|
|
|
|
BOOKING_CREATED
|
|
|
|
BOOKING_RESCHEDULED
|
|
|
|
BOOKING_CANCELLED
|
2022-07-20 18:30:57 +00:00
|
|
|
FORM_SUBMITTED
|
2022-08-15 20:18:41 +00:00
|
|
|
MEETING_ENDED
|
2021-10-07 15:14:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Webhook {
|
2021-11-22 11:37:07 +00:00
|
|
|
id String @id @unique
|
2022-03-02 16:24:57 +00:00
|
|
|
userId Int?
|
|
|
|
eventTypeId Int?
|
2022-10-14 23:41:40 +00:00
|
|
|
/// @zod.url()
|
2021-11-22 11:37:07 +00:00
|
|
|
subscriberUrl String
|
|
|
|
payloadTemplate String?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
active Boolean @default(true)
|
|
|
|
eventTriggers WebhookTriggerEvents[]
|
2022-03-03 19:29:19 +00:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
2022-05-03 23:16:59 +00:00
|
|
|
app App? @relation(fields: [appId], references: [slug], onDelete: Cascade)
|
|
|
|
appId String?
|
2022-06-16 16:21:48 +00:00
|
|
|
secret String?
|
2022-08-31 03:41:23 +00:00
|
|
|
|
|
|
|
@@unique([userId, subscriberUrl], name: "courseIdentifier")
|
2021-10-07 15:14:47 +00:00
|
|
|
}
|
2022-04-16 02:58:34 +00:00
|
|
|
|
2022-04-26 08:48:17 +00:00
|
|
|
model Impersonations {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now())
|
2022-05-26 15:48:02 +00:00
|
|
|
impersonatedUser User @relation("impersonated_user", fields: [impersonatedUserId], references: [id], onDelete: Cascade)
|
|
|
|
impersonatedBy User @relation("impersonated_by_user", fields: [impersonatedById], references: [id], onDelete: Cascade)
|
2022-04-26 08:48:17 +00:00
|
|
|
impersonatedUserId Int
|
|
|
|
impersonatedById Int
|
|
|
|
}
|
|
|
|
|
2022-04-16 02:58:34 +00:00
|
|
|
model ApiKey {
|
|
|
|
id String @id @unique @default(cuid())
|
|
|
|
userId Int
|
|
|
|
note String?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
expiresAt DateTime?
|
|
|
|
lastUsedAt DateTime?
|
|
|
|
hashedKey String @unique()
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2022-05-03 23:16:59 +00:00
|
|
|
app App? @relation(fields: [appId], references: [slug], onDelete: Cascade)
|
|
|
|
appId String?
|
2022-04-16 02:58:34 +00:00
|
|
|
}
|
2022-04-26 15:12:08 +00:00
|
|
|
|
2022-04-28 15:44:26 +00:00
|
|
|
model HashedLink {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
link String @unique()
|
|
|
|
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
|
|
|
eventTypeId Int @unique
|
|
|
|
}
|
|
|
|
|
2022-04-26 15:12:08 +00:00
|
|
|
model Account {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId Int
|
|
|
|
type String
|
|
|
|
provider String
|
|
|
|
providerAccountId String
|
|
|
|
refresh_token String? @db.Text
|
|
|
|
access_token String? @db.Text
|
|
|
|
expires_at Int?
|
|
|
|
token_type String?
|
|
|
|
scope String?
|
|
|
|
id_token String? @db.Text
|
|
|
|
session_state String?
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([provider, providerAccountId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model Session {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
sessionToken String @unique
|
|
|
|
userId Int
|
|
|
|
expires DateTime
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
}
|
2022-05-02 20:39:35 +00:00
|
|
|
|
|
|
|
enum AppCategories {
|
|
|
|
calendar
|
|
|
|
messaging
|
|
|
|
other
|
|
|
|
payment
|
|
|
|
video
|
|
|
|
web3
|
2022-09-15 08:16:56 +00:00
|
|
|
automation
|
2022-10-14 16:24:43 +00:00
|
|
|
analytics
|
2022-05-02 20:39:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model App {
|
|
|
|
// The slug for the app store public page inside `/apps/[slug]`
|
|
|
|
slug String @id @unique
|
|
|
|
// The directory name for `/packages/app-store/[dirName]`
|
|
|
|
dirName String @unique
|
|
|
|
// Needed API Keys
|
|
|
|
keys Json?
|
|
|
|
// One or multiple categories to which this app belongs
|
|
|
|
categories AppCategories[]
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
credentials Credential[]
|
2023-02-08 20:36:22 +00:00
|
|
|
payments Payment[]
|
2022-05-03 23:16:59 +00:00
|
|
|
Webhook Webhook[]
|
|
|
|
ApiKey ApiKey[]
|
2022-12-07 21:47:02 +00:00
|
|
|
enabled Boolean @default(false)
|
2022-05-02 20:39:35 +00:00
|
|
|
}
|
2022-05-24 13:29:39 +00:00
|
|
|
|
2022-07-14 12:40:53 +00:00
|
|
|
model App_RoutingForms_Form {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
description String?
|
|
|
|
routes Json?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
name String
|
|
|
|
fields Json?
|
|
|
|
user User @relation("routing-form", fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
userId Int
|
|
|
|
responses App_RoutingForms_FormResponse[]
|
|
|
|
disabled Boolean @default(false)
|
2022-11-03 14:40:03 +00:00
|
|
|
/// @zod.custom(imports.RoutingFormSettings)
|
|
|
|
settings Json?
|
2022-07-14 12:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model App_RoutingForms_FormResponse {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
formFillerId String @default(cuid())
|
|
|
|
form App_RoutingForms_Form @relation(fields: [formId], references: [id], onDelete: Cascade)
|
|
|
|
formId String
|
|
|
|
response Json
|
2022-08-13 11:04:57 +00:00
|
|
|
createdAt DateTime @default(now())
|
2022-07-14 12:40:53 +00:00
|
|
|
|
|
|
|
@@unique([formFillerId, formId])
|
|
|
|
}
|
|
|
|
|
2022-05-24 13:29:39 +00:00
|
|
|
model Feedback {
|
|
|
|
id Int @id @default(autoincrement())
|
2022-07-20 18:49:53 +00:00
|
|
|
date DateTime @default(now())
|
2022-05-24 13:29:39 +00:00
|
|
|
userId Int
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
rating String
|
|
|
|
comment String?
|
|
|
|
}
|
2022-07-14 00:10:45 +00:00
|
|
|
|
|
|
|
enum WorkflowTriggerEvents {
|
|
|
|
BEFORE_EVENT
|
|
|
|
EVENT_CANCELLED
|
|
|
|
NEW_EVENT
|
2022-10-07 18:18:28 +00:00
|
|
|
AFTER_EVENT
|
2022-08-31 23:09:34 +00:00
|
|
|
RESCHEDULE_EVENT
|
2022-07-14 00:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum WorkflowActions {
|
|
|
|
EMAIL_HOST
|
|
|
|
EMAIL_ATTENDEE
|
|
|
|
SMS_ATTENDEE
|
|
|
|
SMS_NUMBER
|
2022-10-10 13:40:20 +00:00
|
|
|
EMAIL_ADDRESS
|
2022-07-14 00:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model WorkflowStep {
|
2022-12-15 21:54:40 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
stepNumber Int
|
|
|
|
action WorkflowActions
|
|
|
|
workflowId Int
|
|
|
|
workflow Workflow @relation(fields: [workflowId], references: [id], onDelete: Cascade)
|
|
|
|
sendTo String?
|
|
|
|
reminderBody String?
|
|
|
|
emailSubject String?
|
|
|
|
template WorkflowTemplates @default(REMINDER)
|
|
|
|
workflowReminders WorkflowReminder[]
|
|
|
|
numberRequired Boolean?
|
|
|
|
sender String?
|
|
|
|
numberVerificationPending Boolean @default(true)
|
2022-07-14 00:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Workflow {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
2023-02-27 07:24:43 +00:00
|
|
|
userId Int?
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
|
|
|
teamId Int?
|
2022-07-14 00:10:45 +00:00
|
|
|
activeOn WorkflowsOnEventTypes[]
|
|
|
|
trigger WorkflowTriggerEvents
|
|
|
|
time Int?
|
|
|
|
timeUnit TimeUnit?
|
|
|
|
steps WorkflowStep[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model WorkflowsOnEventTypes {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
workflow Workflow @relation(fields: [workflowId], references: [id], onDelete: Cascade)
|
|
|
|
workflowId Int
|
|
|
|
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
|
|
|
eventTypeId Int
|
|
|
|
}
|
|
|
|
|
2023-01-26 20:36:15 +00:00
|
|
|
model Deployment {
|
|
|
|
/// This is a single row table, so we use a fixed id
|
|
|
|
id Int @id @default(1)
|
|
|
|
logo String?
|
|
|
|
/// @zod.custom(imports.DeploymentTheme)
|
|
|
|
theme Json?
|
|
|
|
licenseKey String?
|
|
|
|
agreedLicenseAt DateTime?
|
|
|
|
}
|
|
|
|
|
2022-07-14 00:10:45 +00:00
|
|
|
enum TimeUnit {
|
2022-07-22 17:27:06 +00:00
|
|
|
DAY @map("day")
|
|
|
|
HOUR @map("hour")
|
|
|
|
MINUTE @map("minute")
|
2022-07-14 00:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model WorkflowReminder {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
bookingUid String
|
|
|
|
booking Booking? @relation(fields: [bookingUid], references: [uid], onDelete: Cascade)
|
|
|
|
method WorkflowMethods
|
|
|
|
scheduledDate DateTime
|
|
|
|
referenceId String? @unique
|
|
|
|
scheduled Boolean
|
|
|
|
workflowStepId Int
|
|
|
|
workflowStep WorkflowStep @relation(fields: [workflowStepId], references: [id], onDelete: Cascade)
|
2023-02-20 17:40:08 +00:00
|
|
|
cancelled Boolean?
|
2022-07-14 00:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum WorkflowTemplates {
|
|
|
|
REMINDER
|
|
|
|
CUSTOM
|
|
|
|
}
|
|
|
|
|
|
|
|
enum WorkflowMethods {
|
|
|
|
EMAIL
|
|
|
|
SMS
|
|
|
|
}
|
2022-12-15 21:54:40 +00:00
|
|
|
|
|
|
|
model VerifiedNumber {
|
|
|
|
id Int @id @default(autoincrement())
|
2023-02-27 07:24:43 +00:00
|
|
|
userId Int?
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
teamId Int?
|
|
|
|
team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
2022-12-15 21:54:40 +00:00
|
|
|
phoneNumber String
|
|
|
|
}
|