cal.pub0.org/prisma/schema.prisma

193 lines
5.0 KiB
Plaintext
Raw Normal View History

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?
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?
bookings Booking[]
availability Availability[]
2021-06-15 15:26:16 +00:00
eventName String?
2021-06-19 18:55:40 +00:00
customInputs EventTypeCustomInput[]
timeZone String?
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
emailVerified DateTime?
2021-03-24 15:03:04 +00:00
password String?
2021-03-22 13:48:48 +00:00
bio String?
avatar String?
timeZone String @default("Europe/London")
weekStart String? @default("Sunday")
2021-04-13 16:16:32 +00:00
startTime Int @default(0)
endTime Int @default(1440)
bufferTime Int @default(0)
2021-06-29 16:08:55 +00:00
hideBranding Boolean @default(false)
theme String?
2021-03-22 13:48:48 +00:00
createdDate DateTime @default(now()) @map(name: "created")
eventTypes EventType[]
credentials Credential[]
teams Membership[]
bookings Booking[]
availability Availability[]
selectedCalendars SelectedCalendar[]
2021-06-14 18:53:20 +00:00
2021-03-22 13:48:48 +00:00
@@map(name: "users")
}
model Team {
id Int @default(autoincrement()) @id
name String?
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])
}
model VerificationRequest {
id Int @default(autoincrement()) @id
identifier String
token String @unique
expires DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([identifier, token])
}
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
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[]
2021-07-25 12:37:22 +00:00
location String?
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
}
model Availability {
id Int @default(autoincrement()) @id
2021-06-14 18:53:20 +00:00
label String?
user User? @relation(fields: [userId], references: [id])
2021-06-14 18:53:20 +00:00
userId Int?
eventType EventType? @relation(fields: [eventTypeId], references: [id])
2021-06-14 18:53:20 +00:00
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
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
model EventTypeCustomInput {
id Int @id @default(autoincrement())
eventTypeId Int
eventType EventType @relation(fields: [eventTypeId], references: [id])
label String
type String
required Boolean
}
model ResetPasswordRequest {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
email String
expires DateTime
}
enum ReminderType {
PENDING_BOOKING_CONFIRMATION
}
model ReminderMail {
id Int @id @default(autoincrement())
referenceId Int
reminderType ReminderType
elapsedMinutes Int
createdAt DateTime @default(now())
}