Files
house-plan-maker/apps/server/prisma/schema.prisma
T
alexei.dolgolyov d8a914bf2a feat: editor improvements and collapsible sidebars
Add collapse/expand toggle for the AppShell navigation sidebar and the
editor properties panel (both persisted to localStorage). Bundles other
in-progress editor work including position anchors, outlet sizing, PBR
textures, window slope/frame depth, curtain metadata, and various 2D/3D
rendering tweaks.
2026-04-08 12:27:57 +03:00

144 lines
5.0 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Apartment {
id String @id @default(cuid())
name String
address String?
totalArea Float?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
rooms Room[]
}
model Room {
id String @id @default(cuid())
apartmentId String
name String
shape String @default("[]") // JSON array of {x, y} points
width Float?
height Float?
wallHeight Float @default(2.7)
plinthHeight Float @default(0.06)
plinthThickness Float @default(0.01)
order Int @default(0)
posX Float @default(0)
posY Float @default(0)
floorType String @default("CONCRETE")
wallColor String @default("#f5f0eb")
wallFinish String @default("PAINT")
outletWidth Float @default(0.07)
outletHeight Float @default(0.07)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
apartment Apartment @relation(fields: [apartmentId], references: [id], onDelete: Cascade)
walls Wall[]
openings WallOpening[]
electricalItems ElectricalItem[]
furnitureItems FurnitureItem[]
annotations Annotation[]
@@index([apartmentId])
}
model Wall {
id String @id @default(cuid())
roomId String
startX Float
startY Float
endX Float
endY Float
thickness Float @default(0.1)
direction String @default("OTHER") // NORTH, SOUTH, EAST, WEST, OTHER
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
openings WallOpening[]
@@index([roomId])
}
model WallOpening {
id String @id @default(cuid())
roomId String
wallId String
type String // DOOR, WINDOW
positionAlongWall Float
width Float
height Float
elevationFromFloor Float @default(0)
openDirection String @default("LEFT") // LEFT, RIGHT, INWARD, OUTWARD
anchorH String @default("middle") // left, middle, right (positionAlongWall = center by default)
anchorV String @default("bottom") // top, middle, bottom (elevationFromFloor = bottom edge by default)
gridCols Int @default(2) // window pane subdivision — columns
gridRows Int @default(2) // window pane subdivision — rows
slopeDepth Float @default(0) // window reveal (откос) depth in meters; 0 = no slope shown
frameThickness Float @default(0.03) // door/window frame member thickness in meters
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
wall Wall @relation(fields: [wallId], references: [id], onDelete: Cascade)
@@index([roomId])
@@index([wallId])
}
model ElectricalItem {
id String @id @default(cuid())
roomId String
type String // OUTLET, SWITCH, JUNCTION_BOX, LIGHT_CEILING, LIGHT_WALL, CABLE_ROUTE
x Float
y Float
wallId String?
elevationFromFloor Float?
rotation Float @default(0)
count Int @default(1)
anchorH String @default("middle") // left, middle, right
anchorV String @default("middle") // top, middle, bottom
label String? // user-supplied display name; falls back to symbol def label when null
metadata String? // JSON
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
@@index([roomId])
}
model FurnitureItem {
id String @id @default(cuid())
roomId String
type String // BED, DESK, WARDROBE, SOFA, TABLE, CHAIR, SHELF, NIGHTSTAND, DRESSER, BOOKCASE, OTHER
x Float
y Float
width Float
depth Float
height Float
rotation Float @default(0)
elevationFromFloor Float @default(0)
label String?
anchorH String @default("middle") // left, middle, right
anchorV String @default("middle") // top, middle, bottom
showProjection Boolean @default(false)
opacity Float @default(1)
metadata String? // JSON — type-specific extension bag (e.g. curtain open amount + fabric color)
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
@@index([roomId])
}
model Annotation {
id String @id @default(cuid())
roomId String
x Float @default(0)
y Float @default(0)
text String
fontSize Int?
color String?
attachedToId String?
projectionOffsetX Float?
projectionOffsetY Float?
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
@@index([roomId])
}