Add Booking System
This commit is contained in:
26
packages/database/prisma/schema/booking.prisma
Normal file
26
packages/database/prisma/schema/booking.prisma
Normal file
@@ -0,0 +1,26 @@
|
||||
enum BOOKING_TYPE {
|
||||
STATION
|
||||
LST_01
|
||||
LST_02
|
||||
LST_03
|
||||
LST_04
|
||||
}
|
||||
|
||||
model Booking {
|
||||
id String @id @default(uuid())
|
||||
userId String @map(name: "user_id")
|
||||
type BOOKING_TYPE
|
||||
stationId Int? @map(name: "station_id")
|
||||
startTime DateTime @map(name: "start_time")
|
||||
endTime DateTime @map(name: "end_time")
|
||||
createdAt DateTime @default(now()) @map(name: "created_at")
|
||||
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
||||
|
||||
// Relations
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
station Station? @relation(fields: [stationId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([startTime, endTime])
|
||||
@@index([type, startTime, endTime])
|
||||
@@map(name: "bookings")
|
||||
}
|
||||
Reference in New Issue
Block a user