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 {
|
2022-04-06 12:37:06 +00:00
|
|
|
provider = "prisma-client-js"
|
|
|
|
previewFeatures = ["filterJson"]
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
2022-01-21 21:35:31 +00:00
|
|
|
generator zod {
|
|
|
|
provider = "zod-prisma"
|
|
|
|
output = "./zod"
|
|
|
|
imports = "./zod-utils"
|
|
|
|
relationModel = "default"
|
|
|
|
}
|
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
enum SchedulingType {
|
2021-10-29 14:13:51 +00:00
|
|
|
ROUND_ROBIN @map("roundRobin")
|
|
|
|
COLLECTIVE @map("collective")
|
2021-09-14 08:45:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-18 01:03:19 +00:00
|
|
|
enum PeriodType {
|
|
|
|
UNLIMITED @map("unlimited")
|
|
|
|
ROLLING @map("rolling")
|
|
|
|
RANGE @map("range")
|
|
|
|
}
|
|
|
|
|
2021-03-22 13:48:48 +00:00
|
|
|
model EventType {
|
2021-09-02 12:13:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
2022-01-21 21:35:31 +00:00
|
|
|
/// @zod.nonempty()
|
2021-09-02 12:13:19 +00:00
|
|
|
title String
|
2022-01-21 21:35:31 +00:00
|
|
|
/// @zod.custom(imports.eventTypeSlug)
|
2021-09-02 12:13:19 +00:00
|
|
|
slug String
|
|
|
|
description String?
|
2021-11-15 12:25:49 +00:00
|
|
|
position Int @default(0)
|
2022-01-21 21:35:31 +00:00
|
|
|
/// @zod.custom(imports.eventTypeLocations)
|
2021-09-02 12:13:19 +00:00
|
|
|
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[]
|
2022-03-02 16:24:57 +00:00
|
|
|
webhooks Webhook[]
|
2022-01-21 21:35:31 +00:00
|
|
|
destinationCalendar DestinationCalendar?
|
2021-09-02 12:13:19 +00:00
|
|
|
eventName String?
|
|
|
|
customInputs EventTypeCustomInput[]
|
|
|
|
timeZone String?
|
2021-11-18 01:03:19 +00:00
|
|
|
periodType PeriodType @default(UNLIMITED)
|
2021-09-02 12:13:19 +00:00
|
|
|
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)
|
2022-03-28 18:07:13 +00:00
|
|
|
hideCalendarNotes Boolean @default(false)
|
2021-09-02 12:13:19 +00:00
|
|
|
minimumBookingNotice Int @default(120)
|
2022-03-04 10:19:03 +00:00
|
|
|
beforeEventBuffer Int @default(0)
|
|
|
|
afterEventBuffer Int @default(0)
|
2021-09-14 08:45:28 +00:00
|
|
|
schedulingType SchedulingType?
|
2022-03-17 16:48:23 +00:00
|
|
|
schedule Schedule?
|
2021-10-12 10:09:39 +00:00
|
|
|
price Int @default(0)
|
|
|
|
currency String @default("usd")
|
2021-12-19 12:11:31 +00:00
|
|
|
slotInterval Int?
|
2022-02-01 21:48:40 +00:00
|
|
|
metadata Json?
|
2022-04-05 08:05:40 +00:00
|
|
|
successRedirectUrl String?
|
2021-10-29 14:13:51 +00:00
|
|
|
|
2021-09-22 18:36:13 +00:00
|
|
|
@@unique([userId, slug])
|
2022-04-20 00:35:12 +00:00
|
|
|
@@unique([teamId, 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
|
2022-01-14 13:49:15 +00:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-09-02 12:13:19 +00:00
|
|
|
userId Int?
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
2021-09-06 13:51:15 +00:00
|
|
|
enum UserPlan {
|
|
|
|
FREE
|
|
|
|
TRIAL
|
|
|
|
PRO
|
|
|
|
}
|
|
|
|
|
2022-01-13 20:05:23 +00:00
|
|
|
enum IdentityProvider {
|
|
|
|
CAL
|
|
|
|
GOOGLE
|
|
|
|
SAML
|
|
|
|
}
|
|
|
|
|
2021-12-09 15:51:37 +00:00
|
|
|
model DestinationCalendar {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
integration String
|
|
|
|
externalId String
|
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
userId Int? @unique
|
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
|
|
|
bookingId Int? @unique
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
|
|
|
eventTypeId Int? @unique
|
|
|
|
}
|
|
|
|
|
2022-04-26 08:48:17 +00:00
|
|
|
enum UserPermissionRole {
|
|
|
|
USER
|
|
|
|
ADMIN
|
|
|
|
}
|
|
|
|
|
2021-03-22 13:48:48 +00:00
|
|
|
model User {
|
2021-12-09 15:51:37 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
username String? @unique
|
2021-09-02 12:13:19 +00:00
|
|
|
name String?
|
2022-01-21 21:35:31 +00:00
|
|
|
/// @zod.email()
|
2021-12-09 15:51:37 +00:00
|
|
|
email String @unique
|
2021-09-02 12:13:19 +00:00
|
|
|
emailVerified DateTime?
|
|
|
|
password String?
|
|
|
|
bio String?
|
|
|
|
avatar String?
|
2021-12-09 15:51:37 +00:00
|
|
|
timeZone String @default("Europe/London")
|
|
|
|
weekStart String @default("Sunday")
|
2021-12-08 12:08:57 +00:00
|
|
|
// DEPRECATED - TO BE REMOVED
|
2021-12-09 15:51:37 +00:00
|
|
|
startTime Int @default(0)
|
|
|
|
endTime Int @default(1440)
|
2021-12-08 12:08:57 +00:00
|
|
|
// </DEPRECATED>
|
2021-12-09 15:51:37 +00:00
|
|
|
bufferTime Int @default(0)
|
|
|
|
hideBranding Boolean @default(false)
|
2021-09-02 12:13:19 +00:00
|
|
|
theme String?
|
2021-12-09 15:51:37 +00:00
|
|
|
createdDate DateTime @default(now()) @map(name: "created")
|
2022-03-03 19:29:19 +00:00
|
|
|
trialEndsAt DateTime?
|
2021-12-09 15:51:37 +00:00
|
|
|
eventTypes EventType[] @relation("user_eventtype")
|
2021-09-02 12:13:19 +00:00
|
|
|
credentials Credential[]
|
|
|
|
teams Membership[]
|
|
|
|
bookings Booking[]
|
2022-03-17 16:48:23 +00:00
|
|
|
schedules Schedule[]
|
|
|
|
defaultScheduleId Int?
|
2021-09-02 12:13:19 +00:00
|
|
|
selectedCalendars SelectedCalendar[]
|
2021-12-09 15:51:37 +00:00
|
|
|
completedOnboarding Boolean @default(false)
|
2021-10-29 14:13:51 +00:00
|
|
|
locale String?
|
2022-02-28 16:24:47 +00:00
|
|
|
timeFormat Int? @default(12)
|
2021-09-21 09:29:20 +00:00
|
|
|
twoFactorSecret String?
|
2021-12-09 15:51:37 +00:00
|
|
|
twoFactorEnabled Boolean @default(false)
|
2022-01-13 20:05:23 +00:00
|
|
|
identityProvider IdentityProvider @default(CAL)
|
|
|
|
identityProviderId String?
|
2022-03-17 16:48:23 +00:00
|
|
|
availability Availability[]
|
2022-01-13 20:05:23 +00:00
|
|
|
invitedTo Int?
|
2022-01-17 19:42:38 +00:00
|
|
|
plan UserPlan @default(TRIAL)
|
2021-10-29 14:13:51 +00:00
|
|
|
webhooks Webhook[]
|
2021-12-09 15:51:37 +00:00
|
|
|
brandColor String @default("#292929")
|
2022-03-05 15:37:46 +00:00
|
|
|
darkBrandColor String @default("#fafafa")
|
2021-12-09 15:51:37 +00:00
|
|
|
// the location where the events will end up
|
|
|
|
destinationCalendar DestinationCalendar?
|
2022-01-11 10:32:40 +00:00
|
|
|
away Boolean @default(false)
|
2022-04-06 17:20:30 +00:00
|
|
|
// participate in dynamic group booking or not
|
|
|
|
allowDynamicBooking Boolean? @default(true)
|
2021-12-28 09:15:52 +00:00
|
|
|
metadata Json?
|
2022-02-07 17:16:20 +00:00
|
|
|
verified Boolean? @default(false)
|
2022-04-26 08:48:17 +00:00
|
|
|
role UserPermissionRole @default(USER)
|
|
|
|
impersonatedUsers Impersonations[] @relation("impersonated_user")
|
|
|
|
impersonatedBy Impersonations[] @relation("impersonated_by_user")
|
2022-04-16 02:58:34 +00:00
|
|
|
apiKeys ApiKey[]
|
2022-04-26 15:12:08 +00:00
|
|
|
accounts Account[]
|
|
|
|
sessions Session[]
|
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-10-29 14:13:51 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String?
|
|
|
|
slug String? @unique
|
|
|
|
logo String?
|
|
|
|
bio String?
|
|
|
|
hideBranding Boolean @default(false)
|
|
|
|
members Membership[]
|
|
|
|
eventTypes EventType[]
|
2021-06-05 22:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum MembershipRole {
|
|
|
|
MEMBER
|
2021-12-09 23:51:30 +00:00
|
|
|
ADMIN
|
2021-06-05 22:53:33 +00:00
|
|
|
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])
|
2022-01-14 13:49:15 +00:00
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
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
|
|
|
}
|
|
|
|
|
2022-04-21 20:32:25 +00:00
|
|
|
model VerificationToken {
|
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?
|
2022-04-14 21:25:24 +00:00
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
2021-09-22 22:43:10 +00:00
|
|
|
bookingId Int?
|
2022-04-14 21:25:24 +00:00
|
|
|
deleted Boolean?
|
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
|
2022-01-27 20:32:53 +00:00
|
|
|
locale String? @default("en")
|
2021-09-02 12:13:19 +00:00
|
|
|
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 {
|
2021-10-29 14:13:51 +00:00
|
|
|
CANCELLED @map("cancelled")
|
|
|
|
ACCEPTED @map("accepted")
|
|
|
|
REJECTED @map("rejected")
|
|
|
|
PENDING @map("pending")
|
2021-09-13 08:57:56 +00:00
|
|
|
}
|
|
|
|
|
2021-10-07 16:12:39 +00:00
|
|
|
model DailyEventReference {
|
2021-10-29 14:13:51 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
dailyurl String @default("dailycallurl")
|
|
|
|
dailytoken String @default("dailytoken")
|
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id])
|
2022-02-01 21:48:40 +00:00
|
|
|
bookingId Int? @unique
|
2021-10-07 16:12:39 +00:00
|
|
|
}
|
|
|
|
|
2021-06-05 23:31:03 +00:00
|
|
|
model Booking {
|
2021-12-09 15:51:37 +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?
|
|
|
|
dailyRef DailyEventReference?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime?
|
|
|
|
confirmed Boolean @default(true)
|
|
|
|
rejected Boolean @default(false)
|
|
|
|
status BookingStatus @default(ACCEPTED)
|
|
|
|
paid Boolean @default(false)
|
|
|
|
payment Payment[]
|
|
|
|
destinationCalendar DestinationCalendar?
|
2022-01-28 17:40:29 +00:00
|
|
|
cancellationReason String?
|
2022-02-11 14:34:12 +00:00
|
|
|
rejectionReason String?
|
2022-04-06 17:20:30 +00:00
|
|
|
dynamicEventSlugRef String?
|
|
|
|
dynamicGroupSlugRef String?
|
2022-04-14 21:25:24 +00:00
|
|
|
rescheduled Boolean?
|
|
|
|
fromReschedule String?
|
2021-09-02 12:13:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Schedule {
|
2022-03-17 16:48:23 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
userId Int
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
|
|
|
eventTypeId Int? @unique
|
|
|
|
name String
|
|
|
|
timeZone String?
|
|
|
|
availability Availability[]
|
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())
|
2022-01-14 13:49:15 +00:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-09-02 12:13:19 +00:00
|
|
|
userId Int?
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
|
|
|
eventTypeId Int?
|
|
|
|
days Int[]
|
2021-11-10 11:16:32 +00:00
|
|
|
startTime DateTime @db.Time
|
|
|
|
endTime DateTime @db.Time
|
2021-09-02 12:13:19 +00:00
|
|
|
date DateTime? @db.Date
|
2022-03-17 16:48:23 +00:00
|
|
|
Schedule Schedule? @relation(fields: [scheduleId], references: [id])
|
|
|
|
scheduleId Int?
|
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 {
|
2022-01-14 13:49:15 +00:00
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-09-02 12:13:19 +00:00
|
|
|
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 {
|
2021-10-29 14:13:51 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
uid String @unique
|
|
|
|
type PaymentType
|
|
|
|
bookingId Int
|
2022-04-14 21:25:24 +00:00
|
|
|
booking Booking? @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
2021-10-29 14:13:51 +00:00
|
|
|
amount Int
|
|
|
|
fee Int
|
|
|
|
currency String
|
|
|
|
success Boolean
|
|
|
|
refunded Boolean
|
|
|
|
data Json
|
|
|
|
externalId String @unique
|
2021-09-22 18:36:13 +00:00
|
|
|
}
|
2021-10-07 15:14:47 +00:00
|
|
|
|
|
|
|
enum WebhookTriggerEvents {
|
|
|
|
BOOKING_CREATED
|
|
|
|
BOOKING_RESCHEDULED
|
|
|
|
BOOKING_CANCELLED
|
|
|
|
}
|
|
|
|
|
|
|
|
model Webhook {
|
2021-11-22 11:37:07 +00:00
|
|
|
id String @id @unique
|
2022-03-02 16:24:57 +00:00
|
|
|
userId Int?
|
|
|
|
eventTypeId Int?
|
2021-11-22 11:37:07 +00:00
|
|
|
subscriberUrl String
|
|
|
|
payloadTemplate String?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
active Boolean @default(true)
|
|
|
|
eventTriggers WebhookTriggerEvents[]
|
2022-03-03 19:29:19 +00:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
eventType EventType? @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
2021-10-07 15:14:47 +00:00
|
|
|
}
|
2022-04-16 02:58:34 +00:00
|
|
|
|
2022-04-26 08:48:17 +00:00
|
|
|
model Impersonations {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
impersonatedUser User @relation("impersonated_user", fields: [impersonatedUserId], references: [id])
|
|
|
|
impersonatedBy User @relation("impersonated_by_user", fields: [impersonatedById], references: [id])
|
|
|
|
impersonatedUserId Int
|
|
|
|
impersonatedById Int
|
|
|
|
}
|
|
|
|
|
2022-04-16 02:58:34 +00:00
|
|
|
model ApiKey {
|
|
|
|
id String @id @unique @default(cuid())
|
|
|
|
userId Int
|
|
|
|
note String?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
expiresAt DateTime?
|
|
|
|
lastUsedAt DateTime?
|
|
|
|
hashedKey String @unique()
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
}
|
2022-04-26 15:12:08 +00:00
|
|
|
|
|
|
|
model Account {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId Int
|
|
|
|
type String
|
|
|
|
provider String
|
|
|
|
providerAccountId String
|
|
|
|
refresh_token String? @db.Text
|
|
|
|
access_token String? @db.Text
|
|
|
|
expires_at Int?
|
|
|
|
token_type String?
|
|
|
|
scope String?
|
|
|
|
id_token String? @db.Text
|
|
|
|
session_state String?
|
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([provider, providerAccountId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model Session {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
sessionToken String @unique
|
|
|
|
userId Int
|
|
|
|
expires DateTime
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
}
|