Skip to content

Scheduling infrastructure for absolutely everyone.

Merge branch 'main' into feature/cancel-reschedule-links

nicolas3d4222c63196
diff --cc prisma/schema.prisma
index 593308e4aae,b13197819c9..79847ece604
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@@ -46,43 -45,29 +46,66 @@@ model User
createdDate DateTime @default(now()) @map(name: "created")
eventTypes EventType[]
credentials Credential[]
+ teams Membership[]
-
+ bookings Booking[]
@@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 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?
}