111 lines
2.8 KiB
Plaintext
111 lines
2.8 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Organization {
|
|
id String @id @default(uuid())
|
|
name String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
logoUrl String?
|
|
logoId String? @unique
|
|
buildings Building[]
|
|
logo Asset? @relation(fields: [logoId], references: [id])
|
|
users User[]
|
|
}
|
|
|
|
model Building {
|
|
id String @id @default(uuid())
|
|
name String
|
|
organizationId String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
description String?
|
|
imageUrl String?
|
|
imageId String? @unique
|
|
image Asset? @relation(fields: [imageId], references: [id])
|
|
organization Organization @relation(fields: [organizationId], references: [id])
|
|
floors Floor[]
|
|
}
|
|
|
|
model Floor {
|
|
id String @id @default(uuid())
|
|
number Int
|
|
buildingId String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
planImageUrl String?
|
|
name String?
|
|
planImageId String? @unique
|
|
building Building @relation(fields: [buildingId], references: [id])
|
|
planImage Asset? @relation(fields: [planImageId], references: [id])
|
|
spaces Space[]
|
|
}
|
|
|
|
model Asset {
|
|
id String @id @default(uuid())
|
|
data Bytes
|
|
mimeType String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
building Building?
|
|
floor Floor?
|
|
organization Organization?
|
|
}
|
|
|
|
model Space {
|
|
id String @id @default(uuid())
|
|
name String
|
|
type SpaceType
|
|
floorId String
|
|
x Float?
|
|
y Float?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
height Float?
|
|
width Float?
|
|
reservations Reservation[]
|
|
floor Floor @relation(fields: [floorId], references: [id])
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
email String @unique
|
|
password String
|
|
role Role @default(EMPLOYEE)
|
|
organizationId String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
reservations Reservation[]
|
|
organization Organization @relation(fields: [organizationId], references: [id])
|
|
}
|
|
|
|
model Reservation {
|
|
id String @id @default(uuid())
|
|
startTime DateTime
|
|
endTime DateTime
|
|
userId String
|
|
spaceId String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
space Space @relation(fields: [spaceId], references: [id])
|
|
user User @relation(fields: [userId], references: [id])
|
|
}
|
|
|
|
enum Role {
|
|
ADMIN
|
|
SUPERVISOR
|
|
EMPLOYEE
|
|
}
|
|
|
|
enum SpaceType {
|
|
DESK
|
|
MEETING_ROOM
|
|
AMENITY
|
|
}
|