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"
|
|
|
|
}
|
|
|
|
|
|
|
|
model EventType {
|
|
|
|
id Int @default(autoincrement()) @id
|
|
|
|
title String
|
2021-04-28 12:24:16 +00:00
|
|
|
slug String
|
2021-03-22 13:48:48 +00:00
|
|
|
description String?
|
2021-05-08 19:03:47 +00:00
|
|
|
locations Json?
|
2021-03-22 13:48:48 +00:00
|
|
|
length Int
|
2021-04-28 09:23:30 +00:00
|
|
|
hidden Boolean @default(false)
|
2021-03-22 13:48:48 +00:00
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
userId Int?
|
2021-06-05 23:31:03 +00:00
|
|
|
bookings Booking[]
|
2021-06-28 04:24:15 +00:00
|
|
|
availability Availability[]
|
2021-06-15 15:26:16 +00:00
|
|
|
eventName String?
|
2021-06-19 18:55:40 +00:00
|
|
|
customInputs EventTypeCustomInput[]
|
2021-06-29 01:45:58 +00:00
|
|
|
timeZone String?
|
2021-07-15 14:10:26 +00:00
|
|
|
periodType String? @default("unlimited") // unlimited | rolling | range
|
|
|
|
periodStartDate DateTime?
|
|
|
|
periodEndDate DateTime?
|
|
|
|
periodDays Int?
|
|
|
|
periodCountCalendarDays Boolean?
|
2021-07-17 12:30:29 +00:00
|
|
|
requiresConfirmation Boolean @default(false)
|
2021-07-22 22:52:27 +00:00
|
|
|
minimumBookingNotice Int @default(120)
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Credential {
|
|
|
|
id Int @default(autoincrement()) @id
|
|
|
|
type String
|
|
|
|
key Json
|
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
userId Int?
|
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
|
|
|
id Int @default(autoincrement()) @id
|
|
|
|
username String?
|
|
|
|
name String?
|
|
|
|
email String? @unique
|
2021-06-09 21:29:31 +00:00
|
|
|
emailVerified DateTime?
|
2021-03-24 15:03:04 +00:00
|
|
|
password String?
|
2021-03-22 13:48:48 +00:00
|
|
|
bio String?
|
|
|
|
avatar String?
|
2021-04-16 02:09:22 +00:00
|
|
|
timeZone String @default("Europe/London")
|
2021-05-17 22:10:40 +00:00
|
|
|
weekStart String? @default("Sunday")
|
2021-04-13 16:16:32 +00:00
|
|
|
startTime Int @default(0)
|
|
|
|
endTime Int @default(1440)
|
2021-06-15 16:19:00 +00:00
|
|
|
bufferTime Int @default(0)
|
2021-06-29 16:08:55 +00:00
|
|
|
hideBranding Boolean @default(false)
|
2021-07-09 22:59:21 +00:00
|
|
|
theme String?
|
2021-03-22 13:48:48 +00:00
|
|
|
createdDate DateTime @default(now()) @map(name: "created")
|
|
|
|
eventTypes EventType[]
|
|
|
|
credentials Credential[]
|
2021-06-05 22:53:33 +00:00
|
|
|
teams Membership[]
|
2021-06-05 23:31:03 +00:00
|
|
|
bookings Booking[]
|
2021-06-28 04:24:15 +00:00
|
|
|
availability Availability[]
|
2021-06-14 17:45:24 +00:00
|
|
|
selectedCalendars SelectedCalendar[]
|
2021-06-14 18:53:20 +00:00
|
|
|
|
2021-03-22 13:48:48 +00:00
|
|
|
@@map(name: "users")
|
2021-06-05 22:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Team {
|
|
|
|
id Int @default(autoincrement()) @id
|
|
|
|
name String?
|
2021-08-13 19:44:55 +00:00
|
|
|
slug String?
|
2021-06-05 22:53:33 +00:00
|
|
|
members Membership[]
|
|
|
|
}
|
|
|
|
|
|
|
|
enum MembershipRole {
|
|
|
|
MEMBER
|
|
|
|
OWNER
|
|
|
|
}
|
|
|
|
|
|
|
|
model Membership {
|
|
|
|
teamId Int
|
|
|
|
userId Int
|
|
|
|
accepted Boolean @default(false)
|
|
|
|
role MembershipRole
|
|
|
|
team Team @relation(fields: [teamId], references: [id])
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
|
|
|
|
@@id([userId,teamId])
|
2021-06-09 21:29:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model VerificationRequest {
|
|
|
|
id Int @default(autoincrement()) @id
|
|
|
|
identifier String
|
|
|
|
token String @unique
|
|
|
|
expires DateTime
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([identifier, token])
|
2021-06-11 21:02:07 +00:00
|
|
|
}
|
|
|
|
|
2021-06-05 23:31:03 +00:00
|
|
|
model BookingReference {
|
|
|
|
id Int @default(autoincrement()) @id
|
|
|
|
type String
|
|
|
|
uid String
|
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
|
|
|
bookingId Int?
|
|
|
|
}
|
|
|
|
|
|
|
|
model Attendee {
|
|
|
|
id Int @default(autoincrement()) @id
|
|
|
|
email String
|
|
|
|
name String
|
|
|
|
timeZone String
|
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
|
|
|
bookingId Int?
|
|
|
|
}
|
|
|
|
|
|
|
|
model Booking {
|
|
|
|
id Int @default(autoincrement()) @id
|
2021-06-06 01:51:24 +00:00
|
|
|
uid String @unique
|
2021-06-05 23:31:03 +00:00
|
|
|
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[]
|
2021-07-25 12:37:22 +00:00
|
|
|
location String?
|
2021-06-05 23:31:03 +00:00
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime?
|
2021-07-17 12:30:29 +00:00
|
|
|
confirmed Boolean @default(true)
|
|
|
|
rejected Boolean @default(false)
|
2021-06-14 18:53:20 +00:00
|
|
|
}
|
|
|
|
|
2021-06-28 04:24:15 +00:00
|
|
|
model Availability {
|
2021-06-16 22:27:27 +00:00
|
|
|
id Int @default(autoincrement()) @id
|
2021-06-14 18:53:20 +00:00
|
|
|
label String?
|
2021-06-16 22:27:27 +00:00
|
|
|
user User? @relation(fields: [userId], references: [id])
|
2021-06-14 18:53:20 +00:00
|
|
|
userId Int?
|
2021-06-16 22:27:27 +00:00
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
2021-06-14 18:53:20 +00:00
|
|
|
eventTypeId Int?
|
2021-06-16 22:27:27 +00:00
|
|
|
days Int[]
|
2021-06-28 04:24:15 +00:00
|
|
|
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 {
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
userId Int
|
|
|
|
integration String
|
|
|
|
externalId String
|
|
|
|
@@id([userId,integration,externalId])
|
|
|
|
}
|
2021-06-19 18:55:40 +00:00
|
|
|
|
2021-08-14 17:03:50 +00:00
|
|
|
enum EventTypeCustomInputType {
|
|
|
|
TEXT @map("text")
|
|
|
|
TEXTLONG @map("textLong")
|
|
|
|
NUMBER @map("number")
|
|
|
|
BOOL @map("bool")
|
|
|
|
}
|
|
|
|
|
2021-06-19 18:55:40 +00:00
|
|
|
model EventTypeCustomInput {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
eventTypeId Int
|
|
|
|
eventType EventType @relation(fields: [eventTypeId], references: [id])
|
|
|
|
label String
|
2021-08-14 17:03:50 +00:00
|
|
|
type EventTypeCustomInputType
|
2021-06-19 18:55:40 +00:00
|
|
|
required Boolean
|
2021-08-22 13:06:26 +00:00
|
|
|
placeholder String @default("")
|
2021-06-19 18:55:40 +00:00
|
|
|
}
|
|
|
|
|
2021-06-30 02:01:29 +00:00
|
|
|
model ResetPasswordRequest {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
email String
|
|
|
|
expires DateTime
|
|
|
|
}
|
2021-07-18 19:12:35 +00:00
|
|
|
|
|
|
|
enum ReminderType {
|
|
|
|
PENDING_BOOKING_CONFIRMATION
|
|
|
|
}
|
|
|
|
|
|
|
|
model ReminderMail {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
referenceId Int
|
|
|
|
reminderType ReminderType
|
|
|
|
elapsedMinutes Int
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
}
|