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 {
|
|
|
|
provider = "prisma-client-js"
|
2021-09-22 18:36:13 +00:00
|
|
|
previewFeatures = ["selectRelationCount"]
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
enum SchedulingType {
|
|
|
|
ROUND_ROBIN @map("roundRobin")
|
|
|
|
COLLECTIVE @map("collective")
|
|
|
|
}
|
|
|
|
|
2021-03-22 13:48:48 +00:00
|
|
|
model EventType {
|
2021-09-02 12:13:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
title String
|
|
|
|
slug String
|
|
|
|
description String?
|
|
|
|
locations Json?
|
|
|
|
length Int
|
|
|
|
hidden Boolean @default(false)
|
2021-09-14 08:45:28 +00:00
|
|
|
users User[] @relation("user_eventtype")
|
2021-09-02 12:13:19 +00:00
|
|
|
userId Int?
|
2021-09-14 08:45:28 +00:00
|
|
|
team Team? @relation(fields: [teamId], references: [id])
|
|
|
|
teamId Int?
|
2021-09-02 12:13:19 +00:00
|
|
|
bookings Booking[]
|
|
|
|
availability Availability[]
|
|
|
|
eventName String?
|
|
|
|
customInputs EventTypeCustomInput[]
|
|
|
|
timeZone String?
|
|
|
|
periodType String? @default("unlimited") // unlimited | rolling | range
|
|
|
|
periodStartDate DateTime?
|
|
|
|
periodEndDate DateTime?
|
|
|
|
periodDays Int?
|
2021-07-15 14:10:26 +00:00
|
|
|
periodCountCalendarDays Boolean?
|
2021-09-02 12:13:19 +00:00
|
|
|
requiresConfirmation Boolean @default(false)
|
2021-09-22 11:04:32 +00:00
|
|
|
disableGuests Boolean @default(false)
|
2021-09-02 12:13:19 +00:00
|
|
|
minimumBookingNotice Int @default(120)
|
2021-09-14 08:45:28 +00:00
|
|
|
schedulingType SchedulingType?
|
2021-09-02 12:13:19 +00:00
|
|
|
Schedule Schedule[]
|
2021-09-22 18:36:13 +00:00
|
|
|
price Int @default(0)
|
|
|
|
currency String @default("usd")
|
|
|
|
@@unique([userId, slug])
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Credential {
|
2021-09-02 12:13:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
type String
|
|
|
|
key Json
|
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
userId Int?
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
2021-09-06 13:51:15 +00:00
|
|
|
enum UserPlan {
|
|
|
|
FREE
|
|
|
|
TRIAL
|
|
|
|
PRO
|
|
|
|
}
|
|
|
|
|
2021-03-22 13:48:48 +00:00
|
|
|
model User {
|
2021-09-02 12:13:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2021-09-06 13:51:15 +00:00
|
|
|
username String? @unique
|
2021-09-02 12:13:19 +00:00
|
|
|
name String?
|
|
|
|
email String? @unique
|
|
|
|
emailVerified DateTime?
|
|
|
|
password String?
|
|
|
|
bio String?
|
|
|
|
avatar String?
|
|
|
|
timeZone String @default("Europe/London")
|
|
|
|
weekStart String? @default("Sunday")
|
|
|
|
startTime Int @default(0)
|
|
|
|
endTime Int @default(1440)
|
|
|
|
bufferTime Int @default(0)
|
|
|
|
hideBranding Boolean @default(false)
|
|
|
|
theme String?
|
|
|
|
createdDate DateTime @default(now()) @map(name: "created")
|
2021-09-14 08:45:28 +00:00
|
|
|
eventTypes EventType[] @relation("user_eventtype")
|
2021-09-02 12:13:19 +00:00
|
|
|
credentials Credential[]
|
|
|
|
teams Membership[]
|
|
|
|
bookings Booking[]
|
|
|
|
availability Availability[]
|
|
|
|
selectedCalendars SelectedCalendar[]
|
|
|
|
completedOnboarding Boolean? @default(false)
|
2021-09-23 08:49:17 +00:00
|
|
|
locale String?
|
2021-09-21 09:29:20 +00:00
|
|
|
twoFactorSecret String?
|
|
|
|
twoFactorEnabled Boolean @default(false)
|
2021-09-02 12:13:19 +00:00
|
|
|
|
2021-09-06 13:51:15 +00:00
|
|
|
|
|
|
|
plan UserPlan @default(PRO)
|
2021-09-02 12:13:19 +00:00
|
|
|
Schedule Schedule[]
|
2021-09-14 08:45:28 +00:00
|
|
|
|
2021-03-22 13:48:48 +00:00
|
|
|
@@map(name: "users")
|
2021-06-05 22:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Team {
|
2021-09-14 08:45:28 +00:00
|
|
|
id Int @id @default(autoincrement())
|
Cal 262 refactor edit teams according to the design reference (#516)
* refactored settings/team landing page
* changed team edit flow, WIP
* merge conflict fix for teams.tsx
* minor fixes to edit team, WIP
* invite-member and disband team APIs attached inside edit-team page
* added remove-member API in edit-team page, minor fixes
* minor code fix, WIP
* WIP
* add logo, bio, branding to team schema
* bio, logo, branding, slug patch API and minor code fix-- WIP
* fn to Disband team directly from the dropdown menu in settings/teams page, removed debug remnants --WIP
* Pull latest data after an action in settings/teams-edit page
* added slug conflict check at Patch time
* code clean-up
* initial change request fixes --WIP
* prop type fix and add warn button color theme --WIP
* added warn Button to Dialog
* remaining change request fixes
* added noop from react-query
* updated invited team-list design
* prettier fix for api/teams/profile
* removed noop import and added custom noop
* minor Button fix
* requested changes addressed
2021-09-06 13:22:22 +00:00
|
|
|
name String?
|
2021-09-14 08:45:28 +00:00
|
|
|
slug String? @unique
|
Cal 262 refactor edit teams according to the design reference (#516)
* refactored settings/team landing page
* changed team edit flow, WIP
* merge conflict fix for teams.tsx
* minor fixes to edit team, WIP
* invite-member and disband team APIs attached inside edit-team page
* added remove-member API in edit-team page, minor fixes
* minor code fix, WIP
* WIP
* add logo, bio, branding to team schema
* bio, logo, branding, slug patch API and minor code fix-- WIP
* fn to Disband team directly from the dropdown menu in settings/teams page, removed debug remnants --WIP
* Pull latest data after an action in settings/teams-edit page
* added slug conflict check at Patch time
* code clean-up
* initial change request fixes --WIP
* prop type fix and add warn button color theme --WIP
* added warn Button to Dialog
* remaining change request fixes
* added noop from react-query
* updated invited team-list design
* prettier fix for api/teams/profile
* removed noop import and added custom noop
* minor Button fix
* requested changes addressed
2021-09-06 13:22:22 +00:00
|
|
|
logo String?
|
|
|
|
bio String?
|
2021-09-14 08:45:28 +00:00
|
|
|
hideBranding Boolean @default(false)
|
Cal 262 refactor edit teams according to the design reference (#516)
* refactored settings/team landing page
* changed team edit flow, WIP
* merge conflict fix for teams.tsx
* minor fixes to edit team, WIP
* invite-member and disband team APIs attached inside edit-team page
* added remove-member API in edit-team page, minor fixes
* minor code fix, WIP
* WIP
* add logo, bio, branding to team schema
* bio, logo, branding, slug patch API and minor code fix-- WIP
* fn to Disband team directly from the dropdown menu in settings/teams page, removed debug remnants --WIP
* Pull latest data after an action in settings/teams-edit page
* added slug conflict check at Patch time
* code clean-up
* initial change request fixes --WIP
* prop type fix and add warn button color theme --WIP
* added warn Button to Dialog
* remaining change request fixes
* added noop from react-query
* updated invited team-list design
* prettier fix for api/teams/profile
* removed noop import and added custom noop
* minor Button fix
* requested changes addressed
2021-09-06 13:22:22 +00:00
|
|
|
members Membership[]
|
2021-09-14 08:45:28 +00:00
|
|
|
eventTypes EventType[]
|
2021-06-05 22:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum MembershipRole {
|
|
|
|
MEMBER
|
|
|
|
OWNER
|
|
|
|
}
|
|
|
|
|
|
|
|
model Membership {
|
2021-09-02 12:13:19 +00:00
|
|
|
teamId Int
|
|
|
|
userId Int
|
|
|
|
accepted Boolean @default(false)
|
|
|
|
role MembershipRole
|
|
|
|
team Team @relation(fields: [teamId], references: [id])
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
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
|
|
|
}
|
|
|
|
|
|
|
|
model VerificationRequest {
|
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 {
|
2021-09-22 22:43:10 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
type String
|
|
|
|
uid String
|
|
|
|
meetingId String?
|
|
|
|
meetingPassword String?
|
|
|
|
meetingUrl String?
|
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
|
|
|
bookingId 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
|
|
|
|
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 {
|
|
|
|
CANCELLED @map("cancelled")
|
|
|
|
ACCEPTED @map("accepted")
|
|
|
|
REJECTED @map("rejected")
|
|
|
|
PENDING @map("pending")
|
|
|
|
}
|
|
|
|
|
2021-06-05 23:31:03 +00:00
|
|
|
model Booking {
|
2021-09-02 12:13:19 +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?
|
|
|
|
startTime DateTime
|
|
|
|
endTime DateTime
|
|
|
|
|
|
|
|
attendees Attendee[]
|
|
|
|
location String?
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime?
|
|
|
|
confirmed Boolean @default(true)
|
|
|
|
rejected Boolean @default(false)
|
2021-09-13 08:57:56 +00:00
|
|
|
status BookingStatus @default(ACCEPTED)
|
2021-09-22 18:36:13 +00:00
|
|
|
paid Boolean @default(false)
|
|
|
|
payment Payment[]
|
2021-09-02 12:13:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Schedule {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
user User? @relation(fields: [userId], references: [id])
|
2021-06-05 23:31:03 +00:00
|
|
|
userId Int?
|
2021-09-02 12:13:19 +00:00
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
2021-06-05 23:31:03 +00:00
|
|
|
eventTypeId Int?
|
2021-09-02 12:13:19 +00:00
|
|
|
title String?
|
|
|
|
freeBusyTimes Json?
|
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())
|
|
|
|
label String?
|
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
userId Int?
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
|
|
|
eventTypeId Int?
|
|
|
|
days Int[]
|
|
|
|
startTime Int
|
|
|
|
endTime Int
|
|
|
|
date DateTime? @db.Date
|
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 {
|
2021-09-02 12:13:19 +00:00
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
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 {
|
2021-09-02 12:13:19 +00:00
|
|
|
TEXT @map("text")
|
|
|
|
TEXTLONG @map("textLong")
|
|
|
|
NUMBER @map("number")
|
|
|
|
BOOL @map("bool")
|
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
|
2021-09-02 12:13:19 +00:00
|
|
|
eventType EventType @relation(fields: [eventTypeId], references: [id])
|
2021-06-19 18:55:40 +00:00
|
|
|
label String
|
2021-08-14 17:03:50 +00:00
|
|
|
type EventTypeCustomInputType
|
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
|
|
|
|
|
|
|
enum PaymentType {
|
|
|
|
STRIPE
|
|
|
|
}
|
|
|
|
|
|
|
|
model Payment {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
uid String @unique
|
|
|
|
type PaymentType
|
|
|
|
bookingId Int
|
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
|
|
|
amount Int
|
|
|
|
fee Int
|
|
|
|
currency String
|
|
|
|
success Boolean
|
|
|
|
refunded Boolean
|
|
|
|
data Json
|
|
|
|
externalId String @unique
|
|
|
|
}
|