2021-03-22 10:48:48 -03: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 09:37:06 -03:00
|
|
|
provider = "prisma-client-js"
|
2023-01-26 19:51:03 -03:00
|
|
|
previewFeatures = []
|
2021-03-22 10:48:48 -03:00
|
|
|
}
|
|
|
|
|
2022-01-21 18:35:31 -03:00
|
|
|
generator zod {
|
|
|
|
provider = "zod-prisma"
|
|
|
|
output = "./zod"
|
|
|
|
imports = "./zod-utils"
|
|
|
|
relationModel = "default"
|
|
|
|
}
|
|
|
|
|
2021-09-14 05:45:28 -03:00
|
|
|
enum SchedulingType {
|
2022-07-22 14:27:06 -03:00
|
|
|
ROUND_ROBIN @map("roundRobin")
|
|
|
|
COLLECTIVE @map("collective")
|
2021-09-14 05:45:28 -03:00
|
|
|
}
|
|
|
|
|
2021-11-17 22:03:19 -03:00
|
|
|
enum PeriodType {
|
2022-07-22 14:27:06 -03:00
|
|
|
UNLIMITED @map("unlimited")
|
|
|
|
ROLLING @map("rolling")
|
|
|
|
RANGE @map("range")
|
2021-11-17 22:03:19 -03:00
|
|
|
}
|
|
|
|
|
2023-01-12 18:09:12 -03:00
|
|
|
model Host {
|
|
|
|
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)
|
2023-03-08 19:04:33 -03:00
|
|
|
|
|
|
|
@@id([userId, eventTypeId])
|
2023-01-12 18:09:12 -03:00
|
|
|
}
|
|
|
|
|
2021-03-22 10:48:48 -03:00
|
|
|
model EventType {
|
2022-07-13 21:10:45 -03:00
|
|
|
id Int @id @default(autoincrement())
|
2022-10-10 21:28:24 -03:00
|
|
|
/// @zod.min(1)
|
2021-09-02 09:13:19 -03:00
|
|
|
title String
|
2022-01-21 18:35:31 -03:00
|
|
|
/// @zod.custom(imports.eventTypeSlug)
|
2021-09-02 09:13:19 -03:00
|
|
|
slug String
|
|
|
|
description String?
|
2022-07-13 21:10:45 -03:00
|
|
|
position Int @default(0)
|
2022-01-21 18:35:31 -03:00
|
|
|
/// @zod.custom(imports.eventTypeLocations)
|
2021-09-02 09:13:19 -03:00
|
|
|
locations Json?
|
|
|
|
length Int
|
2022-07-13 21:10:45 -03:00
|
|
|
hidden Boolean @default(false)
|
2023-01-12 18:09:12 -03:00
|
|
|
hosts Host[]
|
2022-07-13 21:10:45 -03:00
|
|
|
users User[] @relation("user_eventtype")
|
2022-07-20 15:49:53 -03:00
|
|
|
owner User? @relation("owner", fields: [userId], references: [id], onDelete: Cascade)
|
2021-09-02 09:13:19 -03:00
|
|
|
userId Int?
|
2022-07-20 15:49:53 -03:00
|
|
|
team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
2021-09-14 05:45:28 -03:00
|
|
|
teamId Int?
|
2022-04-28 12:44:26 -03:00
|
|
|
hashedLink HashedLink?
|
2021-09-02 09:13:19 -03:00
|
|
|
bookings Booking[]
|
|
|
|
availability Availability[]
|
2022-03-02 13:24:57 -03:00
|
|
|
webhooks Webhook[]
|
2022-01-21 18:35:31 -03:00
|
|
|
destinationCalendar DestinationCalendar?
|
2021-09-02 09:13:19 -03:00
|
|
|
eventName String?
|
|
|
|
customInputs EventTypeCustomInput[]
|
2023-03-02 15:15:28 -03:00
|
|
|
/// @zod.custom(imports.eventTypeBookingFields)
|
|
|
|
bookingFields Json?
|
2021-09-02 09:13:19 -03:00
|
|
|
timeZone String?
|
2022-07-13 21:10:45 -03:00
|
|
|
periodType PeriodType @default(UNLIMITED)
|
2021-09-02 09:13:19 -03:00
|
|
|
periodStartDate DateTime?
|
|
|
|
periodEndDate DateTime?
|
|
|
|
periodDays Int?
|
2021-07-15 11:10:26 -03:00
|
|
|
periodCountCalendarDays Boolean?
|
2022-07-13 21:10:45 -03:00
|
|
|
requiresConfirmation Boolean @default(false)
|
2022-06-09 21:32:34 -03:00
|
|
|
/// @zod.custom(imports.recurringEventType)
|
2022-05-05 18:16:25 -03:00
|
|
|
recurringEvent Json?
|
2022-07-13 21:10:45 -03:00
|
|
|
disableGuests Boolean @default(false)
|
|
|
|
hideCalendarNotes Boolean @default(false)
|
|
|
|
minimumBookingNotice Int @default(120)
|
|
|
|
beforeEventBuffer Int @default(0)
|
|
|
|
afterEventBuffer Int @default(0)
|
2022-05-24 10:19:12 -03:00
|
|
|
seatsPerTimeSlot Int?
|
2022-12-19 11:12:18 -03:00
|
|
|
seatsShowAttendees Boolean? @default(false)
|
2021-09-14 05:45:28 -03:00
|
|
|
schedulingType SchedulingType?
|
2022-07-13 21:10:45 -03:00
|
|
|
schedule Schedule? @relation(fields: [scheduleId], references: [id])
|
2022-06-22 12:43:25 -03:00
|
|
|
scheduleId Int?
|
2022-10-14 13:24:43 -03:00
|
|
|
// price is deprecated. It has now moved to metadata.apps.stripe.price. Plan to drop this column.
|
2022-07-13 21:10:45 -03:00
|
|
|
price Int @default(0)
|
2022-10-14 13:24:43 -03:00
|
|
|
// currency is deprecated. It has now moved to metadata.apps.stripe.currency. Plan to drop this column.
|
2022-07-13 21:10:45 -03:00
|
|
|
currency String @default("usd")
|
2021-12-19 09:11:31 -03:00
|
|
|
slotInterval Int?
|
2022-10-14 13:24:43 -03:00
|
|
|
/// @zod.custom(imports.EventTypeMetaDataSchema)
|
2022-02-01 18:48:40 -03:00
|
|
|
metadata Json?
|
2022-08-01 18:44:08 -03:00
|
|
|
/// @zod.custom(imports.successRedirectUrl)
|
2022-04-05 05:05:40 -03:00
|
|
|
successRedirectUrl String?
|
2022-07-13 21:10:45 -03:00
|
|
|
workflows WorkflowsOnEventTypes[]
|
2022-10-12 02:29:04 -03:00
|
|
|
/// @zod.custom(imports.bookingLimitsType)
|
|
|
|
bookingLimits Json?
|
2021-10-29 11:13:51 -03:00
|
|
|
|
2021-09-22 15:36:13 -03:00
|
|
|
@@unique([userId, slug])
|
2022-04-19 21:35:12 -03:00
|
|
|
@@unique([teamId, slug])
|
2021-03-22 10:48:48 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
model Credential {
|
2022-07-06 19:55:29 -03:00
|
|
|
id Int @id @default(autoincrement())
|
2022-08-22 16:34:28 -03:00
|
|
|
// @@type is deprecated
|
2022-07-06 19:55:29 -03: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 03:13:32 -03:00
|
|
|
// How to make it a required column?
|
2022-07-06 19:55:29 -03:00
|
|
|
appId String?
|
2022-07-01 17:55:27 -03:00
|
|
|
destinationCalendars DestinationCalendar[]
|
2022-12-07 18:47:02 -03:00
|
|
|
invalid Boolean? @default(false)
|
2021-03-22 10:48:48 -03:00
|
|
|
}
|
|
|
|
|
2022-01-13 17:05:23 -03:00
|
|
|
enum IdentityProvider {
|
|
|
|
CAL
|
|
|
|
GOOGLE
|
|
|
|
SAML
|
|
|
|
}
|
|
|
|
|
2021-12-09 12:51:37 -03:00
|
|
|
model DestinationCalendar {
|
2022-07-06 19:55:29 -03:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
integration String
|
|
|
|
externalId String
|
2022-08-22 16:34:28 -03:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2022-07-06 19:55:29 -03:00
|
|
|
userId Int? @unique
|
2022-07-18 12:37:47 -03:00
|
|
|
booking Booking[]
|
2022-08-22 16:34:28 -03:00
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
2022-07-06 19:55:29 -03:00
|
|
|
eventTypeId Int? @unique
|
2022-07-01 17:55:27 -03:00
|
|
|
credentialId Int?
|
2022-08-22 16:34:28 -03:00
|
|
|
credential Credential? @relation(fields: [credentialId], references: [id], onDelete: Cascade)
|
2021-12-09 12:51:37 -03:00
|
|
|
}
|
|
|
|
|
2022-04-26 05:48:17 -03:00
|
|
|
enum UserPermissionRole {
|
|
|
|
USER
|
|
|
|
ADMIN
|
|
|
|
}
|
|
|
|
|
2021-03-22 10:48:48 -03:00
|
|
|
model User {
|
2022-07-14 09:40:53 -03:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
username String? @unique
|
2022-05-25 12:21:18 -03:00
|
|
|
name String?
|
2022-01-21 18:35:31 -03:00
|
|
|
/// @zod.email()
|
2022-07-14 09:40:53 -03:00
|
|
|
email String @unique
|
2022-05-25 12:21:18 -03:00
|
|
|
emailVerified DateTime?
|
|
|
|
password String?
|
|
|
|
bio String?
|
|
|
|
avatar String?
|
2022-07-14 09:40:53 -03:00
|
|
|
timeZone String @default("Europe/London")
|
|
|
|
weekStart String @default("Sunday")
|
2021-12-08 09:08:57 -03:00
|
|
|
// DEPRECATED - TO BE REMOVED
|
2022-07-14 09:40:53 -03:00
|
|
|
startTime Int @default(0)
|
|
|
|
endTime Int @default(1440)
|
2021-12-08 09:08:57 -03:00
|
|
|
// </DEPRECATED>
|
2022-07-14 09:40:53 -03:00
|
|
|
bufferTime Int @default(0)
|
|
|
|
hideBranding Boolean @default(false)
|
2022-05-25 12:21:18 -03:00
|
|
|
theme String?
|
2022-07-14 09:40:53 -03:00
|
|
|
createdDate DateTime @default(now()) @map(name: "created")
|
2022-05-25 12:21:18 -03:00
|
|
|
trialEndsAt DateTime?
|
2022-07-14 09:40:53 -03:00
|
|
|
eventTypes EventType[] @relation("user_eventtype")
|
2022-05-25 12:21:18 -03:00
|
|
|
credentials Credential[]
|
|
|
|
teams Membership[]
|
|
|
|
bookings Booking[]
|
|
|
|
schedules Schedule[]
|
|
|
|
defaultScheduleId Int?
|
|
|
|
selectedCalendars SelectedCalendar[]
|
2022-07-14 09:40:53 -03:00
|
|
|
completedOnboarding Boolean @default(false)
|
2022-05-25 12:21:18 -03:00
|
|
|
locale String?
|
2022-07-14 09:40:53 -03:00
|
|
|
timeFormat Int? @default(12)
|
2022-05-25 12:21:18 -03:00
|
|
|
twoFactorSecret String?
|
2022-07-14 09:40:53 -03:00
|
|
|
twoFactorEnabled Boolean @default(false)
|
|
|
|
identityProvider IdentityProvider @default(CAL)
|
2022-05-25 12:21:18 -03:00
|
|
|
identityProviderId String?
|
|
|
|
availability Availability[]
|
|
|
|
invitedTo Int?
|
|
|
|
webhooks Webhook[]
|
2022-07-14 09:40:53 -03:00
|
|
|
brandColor String @default("#292929")
|
|
|
|
darkBrandColor String @default("#fafafa")
|
2021-12-09 12:51:37 -03:00
|
|
|
// the location where the events will end up
|
2022-05-25 12:21:18 -03:00
|
|
|
destinationCalendar DestinationCalendar?
|
2022-07-14 09:40:53 -03:00
|
|
|
away Boolean @default(false)
|
2022-04-06 14:20:30 -03:00
|
|
|
// participate in dynamic group booking or not
|
2022-07-14 09:40:53 -03:00
|
|
|
allowDynamicBooking Boolean? @default(true)
|
2022-06-14 17:07:54 -03:00
|
|
|
/// @zod.custom(imports.userMetadata)
|
2022-05-25 12:21:18 -03:00
|
|
|
metadata Json?
|
2022-07-14 09:40:53 -03: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 12:21:18 -03:00
|
|
|
apiKeys ApiKey[]
|
|
|
|
accounts Account[]
|
|
|
|
sessions Session[]
|
2022-07-20 15:49:53 -03:00
|
|
|
Feedback Feedback[]
|
|
|
|
ownedEventTypes EventType[] @relation("owner")
|
2022-07-13 21:10:45 -03:00
|
|
|
workflows Workflow[]
|
2022-07-14 09:40:53 -03:00
|
|
|
routingForms App_RoutingForms_Form[] @relation("routing-form")
|
2022-12-15 18:54:40 -03:00
|
|
|
verifiedNumbers VerifiedNumber[]
|
2023-01-12 18:09:12 -03:00
|
|
|
hosts Host[]
|
2022-07-14 09:40:53 -03:00
|
|
|
|
2021-03-22 10:48:48 -03:00
|
|
|
@@map(name: "users")
|
2021-06-05 19:53:33 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
model Team {
|
2023-02-27 04:24:43 -03:00
|
|
|
id Int @id @default(autoincrement())
|
2022-10-10 21:28:24 -03:00
|
|
|
/// @zod.min(1)
|
2023-01-06 07:55:57 -03:00
|
|
|
name String
|
2022-10-10 21:28:24 -03:00
|
|
|
/// @zod.min(1)
|
2023-02-27 04:24:43 -03:00
|
|
|
slug String? @unique
|
2023-01-06 07:55:57 -03:00
|
|
|
logo String?
|
|
|
|
bio String?
|
2023-02-27 04:24:43 -03:00
|
|
|
hideBranding Boolean @default(false)
|
|
|
|
hideBookATeamMember Boolean @default(false)
|
2023-01-06 07:55:57 -03:00
|
|
|
members Membership[]
|
|
|
|
eventTypes EventType[]
|
2023-02-27 04:24:43 -03:00
|
|
|
workflows Workflow[]
|
|
|
|
createdAt DateTime @default(now())
|
2022-11-10 17:23:56 -03:00
|
|
|
/// @zod.custom(imports.teamMetadataSchema)
|
2023-01-06 07:55:57 -03:00
|
|
|
metadata Json?
|
2023-02-01 15:27:26 -03:00
|
|
|
theme String?
|
2023-02-27 04:24:43 -03:00
|
|
|
brandColor String @default("#292929")
|
|
|
|
darkBrandColor String @default("#fafafa")
|
|
|
|
verifiedNumbers VerifiedNumber[]
|
2021-06-05 19:53:33 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
enum MembershipRole {
|
|
|
|
MEMBER
|
2021-12-09 20:51:30 -03:00
|
|
|
ADMIN
|
2021-06-05 19:53:33 -03:00
|
|
|
OWNER
|
|
|
|
}
|
|
|
|
|
|
|
|
model Membership {
|
2022-07-21 14:02:20 -03:00
|
|
|
teamId Int
|
|
|
|
userId Int
|
|
|
|
accepted Boolean @default(false)
|
|
|
|
role MembershipRole
|
2022-10-10 22:24:46 -03:00
|
|
|
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
2022-07-21 14:02:20 -03:00
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
disableImpersonation Boolean @default(false)
|
2021-06-05 19:53:33 -03:00
|
|
|
|
2021-09-02 09:13:19 -03:00
|
|
|
@@id([userId, teamId])
|
2021-06-09 18:29:31 -03:00
|
|
|
}
|
|
|
|
|
2022-04-21 17:32:25 -03:00
|
|
|
model VerificationToken {
|
2021-09-02 09:13:19 -03:00
|
|
|
id Int @id @default(autoincrement())
|
2021-06-09 18:29:31 -03:00
|
|
|
identifier String
|
|
|
|
token String @unique
|
|
|
|
expires DateTime
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
2021-09-02 09:13:19 -03:00
|
|
|
|
2021-06-09 18:29:31 -03:00
|
|
|
@@unique([identifier, token])
|
2021-06-11 18:02:07 -03:00
|
|
|
}
|
|
|
|
|
2021-06-05 20:31:03 -03:00
|
|
|
model BookingReference {
|
2022-05-17 16:31:49 -03:00
|
|
|
id Int @id @default(autoincrement())
|
2022-10-11 00:33:38 -03:00
|
|
|
/// @zod.min(1)
|
2022-05-17 16:31:49 -03:00
|
|
|
type String
|
2022-10-11 00:33:38 -03:00
|
|
|
/// @zod.min(1)
|
2022-05-17 16:31:49 -03:00
|
|
|
uid String
|
|
|
|
meetingId String?
|
|
|
|
meetingPassword String?
|
|
|
|
meetingUrl String?
|
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
|
|
|
bookingId Int?
|
2022-05-16 17:20:09 -03:00
|
|
|
externalCalendarId String?
|
2022-05-17 16:31:49 -03:00
|
|
|
deleted Boolean?
|
2022-07-18 12:37:47 -03:00
|
|
|
credentialId Int?
|
2021-06-05 20:31:03 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
model Attendee {
|
2021-09-02 09:13:19 -03:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
email String
|
|
|
|
name String
|
|
|
|
timeZone String
|
2022-01-27 17:32:53 -03:00
|
|
|
locale String? @default("en")
|
2021-09-02 09:13:19 -03:00
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
|
|
|
bookingId Int?
|
2021-06-05 20:31:03 -03:00
|
|
|
}
|
|
|
|
|
2021-09-13 05:57:56 -03:00
|
|
|
enum BookingStatus {
|
2022-07-22 14:27:06 -03:00
|
|
|
CANCELLED @map("cancelled")
|
|
|
|
ACCEPTED @map("accepted")
|
|
|
|
REJECTED @map("rejected")
|
|
|
|
PENDING @map("pending")
|
2021-09-13 05:57:56 -03:00
|
|
|
}
|
|
|
|
|
2021-06-05 20:31:03 -03:00
|
|
|
model Booking {
|
2022-07-18 12:37:47 -03: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 15:15:28 -03:00
|
|
|
/// @zod.custom(imports.bookingResponses)
|
|
|
|
responses Json?
|
2022-07-18 12:37:47 -03: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 17:18:41 -03:00
|
|
|
scheduledJobs String[]
|
2022-12-15 18:43:07 -03:00
|
|
|
/// @zod.custom(imports.bookingMetadataSchema)
|
|
|
|
metadata Json?
|
2021-09-02 09:13:19 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
model Schedule {
|
2022-03-17 13:48:23 -03:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
userId Int
|
2022-06-22 12:43:25 -03:00
|
|
|
eventType EventType[]
|
2022-03-17 13:48:23 -03:00
|
|
|
name String
|
|
|
|
timeZone String?
|
|
|
|
availability Availability[]
|
2023-01-05 19:29:03 -03:00
|
|
|
|
|
|
|
@@index([userId])
|
2021-06-14 15:53:20 -03:00
|
|
|
}
|
|
|
|
|
2021-06-28 01:24:15 -03:00
|
|
|
model Availability {
|
2021-09-02 09:13:19 -03:00
|
|
|
id Int @id @default(autoincrement())
|
2022-01-14 10:49:15 -03:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-09-02 09:13:19 -03:00
|
|
|
userId Int?
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
|
|
|
eventTypeId Int?
|
|
|
|
days Int[]
|
2021-11-10 08:16:32 -03:00
|
|
|
startTime DateTime @db.Time
|
|
|
|
endTime DateTime @db.Time
|
2021-09-02 09:13:19 -03:00
|
|
|
date DateTime? @db.Date
|
2022-03-17 13:48:23 -03:00
|
|
|
Schedule Schedule? @relation(fields: [scheduleId], references: [id])
|
|
|
|
scheduleId Int?
|
2023-01-05 19:29:03 -03:00
|
|
|
|
|
|
|
@@index([eventTypeId])
|
|
|
|
@@index([scheduleId])
|
2021-06-14 15:53:20 -03:00
|
|
|
}
|
2021-06-20 14:52:18 -03:00
|
|
|
|
2021-06-14 14:45:24 -03:00
|
|
|
model SelectedCalendar {
|
2022-01-14 10:49:15 -03:00
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-09-02 09:13:19 -03:00
|
|
|
userId Int
|
|
|
|
integration String
|
|
|
|
externalId String
|
|
|
|
|
|
|
|
@@id([userId, integration, externalId])
|
2021-06-14 14:45:24 -03:00
|
|
|
}
|
2021-06-19 15:55:40 -03:00
|
|
|
|
2021-08-14 14:03:50 -03:00
|
|
|
enum EventTypeCustomInputType {
|
2022-07-22 14:27:06 -03:00
|
|
|
TEXT @map("text")
|
|
|
|
TEXTLONG @map("textLong")
|
|
|
|
NUMBER @map("number")
|
|
|
|
BOOL @map("bool")
|
2022-12-01 18:53:52 -03:00
|
|
|
RADIO @map("radio")
|
2022-12-16 16:39:41 -03:00
|
|
|
PHONE @map("phone")
|
2021-08-14 14:03:50 -03:00
|
|
|
}
|
|
|
|
|
2021-06-19 15:55:40 -03:00
|
|
|
model EventTypeCustomInput {
|
2021-09-02 09:13:19 -03:00
|
|
|
id Int @id @default(autoincrement())
|
2021-06-19 15:55:40 -03:00
|
|
|
eventTypeId Int
|
2022-07-20 15:49:53 -03:00
|
|
|
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
2021-06-19 15:55:40 -03:00
|
|
|
label String
|
2021-08-14 14:03:50 -03:00
|
|
|
type EventTypeCustomInputType
|
2023-01-07 14:17:32 -03:00
|
|
|
/// @zod.custom(imports.customInputOptionSchema)
|
2022-12-01 18:53:52 -03:00
|
|
|
options Json?
|
2021-06-19 15:55:40 -03:00
|
|
|
required Boolean
|
2021-09-06 10:51:15 -03:00
|
|
|
placeholder String @default("")
|
2021-06-19 15:55:40 -03:00
|
|
|
}
|
|
|
|
|
2021-06-29 23:01:29 -03:00
|
|
|
model ResetPasswordRequest {
|
2021-09-02 09:13:19 -03:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
email String
|
|
|
|
expires DateTime
|
2021-06-29 23:01:29 -03:00
|
|
|
}
|
2021-07-18 16:12:35 -03:00
|
|
|
|
|
|
|
enum ReminderType {
|
|
|
|
PENDING_BOOKING_CONFIRMATION
|
|
|
|
}
|
|
|
|
|
|
|
|
model ReminderMail {
|
2021-09-02 09:13:19 -03:00
|
|
|
id Int @id @default(autoincrement())
|
2021-07-18 16:12:35 -03:00
|
|
|
referenceId Int
|
|
|
|
reminderType ReminderType
|
|
|
|
elapsedMinutes Int
|
2021-09-02 09:13:19 -03:00
|
|
|
createdAt DateTime @default(now())
|
2021-07-18 16:12:35 -03:00
|
|
|
}
|
2021-09-22 15:36:13 -03:00
|
|
|
|
|
|
|
model Payment {
|
2023-02-08 17:36:22 -03:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
uid String @unique
|
|
|
|
app App? @relation(fields: [appId], references: [slug], onDelete: Cascade)
|
|
|
|
appId String?
|
2021-10-29 11:13:51 -03:00
|
|
|
bookingId Int
|
2023-02-08 17:36:22 -03:00
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
2021-10-29 11:13:51 -03:00
|
|
|
amount Int
|
|
|
|
fee Int
|
|
|
|
currency String
|
|
|
|
success Boolean
|
|
|
|
refunded Boolean
|
|
|
|
data Json
|
2023-02-08 17:36:22 -03:00
|
|
|
externalId String @unique
|
2021-09-22 15:36:13 -03:00
|
|
|
}
|
2021-10-07 12:14:47 -03:00
|
|
|
|
|
|
|
enum WebhookTriggerEvents {
|
|
|
|
BOOKING_CREATED
|
|
|
|
BOOKING_RESCHEDULED
|
|
|
|
BOOKING_CANCELLED
|
2022-07-20 15:30:57 -03:00
|
|
|
FORM_SUBMITTED
|
2022-08-15 17:18:41 -03:00
|
|
|
MEETING_ENDED
|
2021-10-07 12:14:47 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
model Webhook {
|
2021-11-22 08:37:07 -03:00
|
|
|
id String @id @unique
|
2022-03-02 13:24:57 -03:00
|
|
|
userId Int?
|
|
|
|
eventTypeId Int?
|
2022-10-14 20:41:40 -03:00
|
|
|
/// @zod.url()
|
2021-11-22 08:37:07 -03:00
|
|
|
subscriberUrl String
|
|
|
|
payloadTemplate String?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
active Boolean @default(true)
|
|
|
|
eventTriggers WebhookTriggerEvents[]
|
2022-03-03 16:29:19 -03:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
2022-05-03 20:16:59 -03:00
|
|
|
app App? @relation(fields: [appId], references: [slug], onDelete: Cascade)
|
|
|
|
appId String?
|
2022-06-16 13:21:48 -03:00
|
|
|
secret String?
|
2022-08-31 00:41:23 -03:00
|
|
|
|
|
|
|
@@unique([userId, subscriberUrl], name: "courseIdentifier")
|
2021-10-07 12:14:47 -03:00
|
|
|
}
|
2022-04-15 23:58:34 -03:00
|
|
|
|
2022-04-26 05:48:17 -03:00
|
|
|
model Impersonations {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now())
|
2022-05-26 12:48:02 -03: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 05:48:17 -03:00
|
|
|
impersonatedUserId Int
|
|
|
|
impersonatedById Int
|
|
|
|
}
|
|
|
|
|
2022-04-15 23:58:34 -03: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 20:16:59 -03:00
|
|
|
app App? @relation(fields: [appId], references: [slug], onDelete: Cascade)
|
|
|
|
appId String?
|
2022-04-15 23:58:34 -03:00
|
|
|
}
|
2022-04-26 12:12:08 -03:00
|
|
|
|
2022-04-28 12:44:26 -03: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 12:12:08 -03: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 17:39:35 -03:00
|
|
|
|
|
|
|
enum AppCategories {
|
|
|
|
calendar
|
|
|
|
messaging
|
|
|
|
other
|
|
|
|
payment
|
|
|
|
video
|
|
|
|
web3
|
2022-09-15 05:16:56 -03:00
|
|
|
automation
|
2022-10-14 13:24:43 -03:00
|
|
|
analytics
|
2022-05-02 17:39:35 -03: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 17:36:22 -03:00
|
|
|
payments Payment[]
|
2022-05-03 20:16:59 -03:00
|
|
|
Webhook Webhook[]
|
|
|
|
ApiKey ApiKey[]
|
2022-12-07 18:47:02 -03:00
|
|
|
enabled Boolean @default(false)
|
2022-05-02 17:39:35 -03:00
|
|
|
}
|
2022-05-24 10:29:39 -03:00
|
|
|
|
2022-07-14 09:40:53 -03: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 11:40:03 -03:00
|
|
|
/// @zod.custom(imports.RoutingFormSettings)
|
|
|
|
settings Json?
|
2022-07-14 09:40:53 -03: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 08:04:57 -03:00
|
|
|
createdAt DateTime @default(now())
|
2022-07-14 09:40:53 -03:00
|
|
|
|
|
|
|
@@unique([formFillerId, formId])
|
|
|
|
}
|
|
|
|
|
2022-05-24 10:29:39 -03:00
|
|
|
model Feedback {
|
|
|
|
id Int @id @default(autoincrement())
|
2022-07-20 15:49:53 -03:00
|
|
|
date DateTime @default(now())
|
2022-05-24 10:29:39 -03:00
|
|
|
userId Int
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
rating String
|
|
|
|
comment String?
|
|
|
|
}
|
2022-07-13 21:10:45 -03:00
|
|
|
|
|
|
|
enum WorkflowTriggerEvents {
|
|
|
|
BEFORE_EVENT
|
|
|
|
EVENT_CANCELLED
|
|
|
|
NEW_EVENT
|
2022-10-07 15:18:28 -03:00
|
|
|
AFTER_EVENT
|
2022-08-31 20:09:34 -03:00
|
|
|
RESCHEDULE_EVENT
|
2022-07-13 21:10:45 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
enum WorkflowActions {
|
|
|
|
EMAIL_HOST
|
|
|
|
EMAIL_ATTENDEE
|
|
|
|
SMS_ATTENDEE
|
|
|
|
SMS_NUMBER
|
2022-10-10 10:40:20 -03:00
|
|
|
EMAIL_ADDRESS
|
2022-07-13 21:10:45 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
model WorkflowStep {
|
2022-12-15 18:54:40 -03: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-13 21:10:45 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
model Workflow {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
2023-02-27 04:24:43 -03: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-13 21:10:45 -03: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 17:36:15 -03: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-13 21:10:45 -03:00
|
|
|
enum TimeUnit {
|
2022-07-22 14:27:06 -03:00
|
|
|
DAY @map("day")
|
|
|
|
HOUR @map("hour")
|
|
|
|
MINUTE @map("minute")
|
2022-07-13 21:10:45 -03: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 14:40:08 -03:00
|
|
|
cancelled Boolean?
|
2022-07-13 21:10:45 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
enum WorkflowTemplates {
|
|
|
|
REMINDER
|
|
|
|
CUSTOM
|
|
|
|
}
|
|
|
|
|
|
|
|
enum WorkflowMethods {
|
|
|
|
EMAIL
|
|
|
|
SMS
|
|
|
|
}
|
2022-12-15 18:54:40 -03:00
|
|
|
|
|
|
|
model VerifiedNumber {
|
|
|
|
id Int @id @default(autoincrement())
|
2023-02-27 04:24:43 -03: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 18:54:40 -03:00
|
|
|
phoneNumber String
|
|
|
|
}
|