
* Heavy WIP * More WIP * Playing with backwards compat * Moar wip * wip * Email changes for group feature * Committing in redundant migrations for reference * Combine all WIP migrations into a single feature migration * Make backup of current version of radio area pending refactor * Improved accessibility through keyboard * Cleanup in seperate commit so I can cherrypick later * Added RadioArea component * wip * Ignore .yarn file * Kinda stable * Getting closer... * Hide header when there are only personal events * Added uid to event create, updated EventTypeDescription * Delete redundant migration * Committing new team related migrations * Optimising & implemented backwards compatibility * Removed now redundant pages * Undid prototyping to calendarClient I did not end up using * Properly typed Select & fixed lint throughout * How'd that get here, removed. * TODO: investigate why userData is not compatible with passed type * This likely matches the event type that is created for a user * Few bugfixes * Adding datepicker optimisations * Fixed new event type spacing, initial profile should always be there * Gave NEXT_PUBLIC_BASE_URL a try but I think it's not the right solution * Updated EventTypeDescription to account for long titles, added logo to team page. * Added logo to team query * Added cancel Cypress test because an upcoming merge contains changes * Fix for when the event type description is long * Turned Theme into the useTheme hook, and made it fully compatible with teams pages * Built AvatarGroup ui component + moved Avatar to ui * Give the avatar some space fom the description * Fixed timeZone selector * Disabled tooltip +1-... Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
245 lines
6.7 KiB
Text
245 lines
6.7 KiB
Text
// 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"
|
|
}
|
|
|
|
enum SchedulingType {
|
|
ROUND_ROBIN @map("roundRobin")
|
|
COLLECTIVE @map("collective")
|
|
}
|
|
|
|
model EventType {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
slug String
|
|
description String?
|
|
locations Json?
|
|
length Int
|
|
hidden Boolean @default(false)
|
|
users User[] @relation("user_eventtype")
|
|
userId Int?
|
|
team Team? @relation(fields: [teamId], references: [id])
|
|
teamId Int?
|
|
bookings Booking[]
|
|
availability Availability[]
|
|
eventName String?
|
|
customInputs EventTypeCustomInput[]
|
|
timeZone String?
|
|
periodType String? @default("unlimited") // unlimited | rolling | range
|
|
periodStartDate DateTime?
|
|
periodEndDate DateTime?
|
|
periodDays Int?
|
|
periodCountCalendarDays Boolean?
|
|
requiresConfirmation Boolean @default(false)
|
|
minimumBookingNotice Int @default(120)
|
|
schedulingType SchedulingType?
|
|
Schedule Schedule[]
|
|
}
|
|
|
|
model Credential {
|
|
id Int @id @default(autoincrement())
|
|
type String
|
|
key Json
|
|
user User? @relation(fields: [userId], references: [id])
|
|
userId Int?
|
|
}
|
|
|
|
enum UserPlan {
|
|
FREE
|
|
TRIAL
|
|
PRO
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
username String? @unique
|
|
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")
|
|
eventTypes EventType[] @relation("user_eventtype")
|
|
credentials Credential[]
|
|
teams Membership[]
|
|
bookings Booking[]
|
|
availability Availability[]
|
|
selectedCalendars SelectedCalendar[]
|
|
completedOnboarding Boolean? @default(false)
|
|
|
|
|
|
plan UserPlan @default(PRO)
|
|
Schedule Schedule[]
|
|
|
|
@@map(name: "users")
|
|
}
|
|
|
|
model Team {
|
|
id Int @id @default(autoincrement())
|
|
name String?
|
|
slug String? @unique
|
|
logo String?
|
|
bio String?
|
|
hideBranding Boolean @default(false)
|
|
members Membership[]
|
|
eventTypes EventType[]
|
|
}
|
|
|
|
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 @id @default(autoincrement())
|
|
identifier String
|
|
token String @unique
|
|
expires DateTime
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([identifier, token])
|
|
}
|
|
|
|
model BookingReference {
|
|
id Int @id @default(autoincrement())
|
|
type String
|
|
uid String
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
|
bookingId Int?
|
|
}
|
|
|
|
model Attendee {
|
|
id Int @id @default(autoincrement())
|
|
email String
|
|
name String
|
|
timeZone String
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
|
bookingId Int?
|
|
}
|
|
|
|
enum BookingStatus {
|
|
CANCELLED @map("cancelled")
|
|
ACCEPTED @map("accepted")
|
|
REJECTED @map("rejected")
|
|
PENDING @map("pending")
|
|
}
|
|
|
|
model Booking {
|
|
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)
|
|
status BookingStatus @default(ACCEPTED)
|
|
}
|
|
|
|
model Schedule {
|
|
id Int @id @default(autoincrement())
|
|
user User? @relation(fields: [userId], references: [id])
|
|
userId Int?
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
|
eventTypeId Int?
|
|
title String?
|
|
freeBusyTimes Json?
|
|
}
|
|
|
|
model Availability {
|
|
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
|
|
}
|
|
|
|
model SelectedCalendar {
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int
|
|
integration String
|
|
externalId String
|
|
|
|
@@id([userId, integration, externalId])
|
|
}
|
|
|
|
enum EventTypeCustomInputType {
|
|
TEXT @map("text")
|
|
TEXTLONG @map("textLong")
|
|
NUMBER @map("number")
|
|
BOOL @map("bool")
|
|
}
|
|
|
|
model EventTypeCustomInput {
|
|
id Int @id @default(autoincrement())
|
|
eventTypeId Int
|
|
eventType EventType @relation(fields: [eventTypeId], references: [id])
|
|
label String
|
|
type EventTypeCustomInputType
|
|
required Boolean
|
|
placeholder String @default("")
|
|
}
|
|
|
|
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())
|
|
}
|