153 lines
3.8 KiB
Plaintext
153 lines
3.8 KiB
Plaintext
// 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
|
|
slug String
|
|
description String?
|
|
locations Json?
|
|
length Int
|
|
hidden Boolean @default(false)
|
|
user User? @relation(fields: [userId], references: [id])
|
|
userId Int?
|
|
bookings Booking[]
|
|
eventName String?
|
|
customInputs EventTypeCustomInput[]
|
|
}
|
|
|
|
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?
|
|
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)
|
|
createdDate DateTime @default(now()) @map(name: "created")
|
|
eventTypes EventType[]
|
|
credentials Credential[]
|
|
teams Membership[]
|
|
bookings Booking[]
|
|
selectedCalendars SelectedCalendar[]
|
|
@@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[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime?
|
|
}
|
|
|
|
model SelectedCalendar {
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int
|
|
integration String
|
|
externalId String
|
|
@@id([userId,integration,externalId])
|
|
}
|
|
|
|
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
|
|
}
|
|
|