100 lines
2.7 KiB
Plaintext
100 lines
2.7 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum EquipmentStatus {
|
|
Active
|
|
Repair
|
|
Reserve
|
|
WriteOff
|
|
}
|
|
|
|
enum laborOperation {
|
|
Manual
|
|
MachineManual
|
|
Machine
|
|
}
|
|
|
|
enum EnumPeriodicityTO {
|
|
EZHEDNEVNOE @map("Ежедневное")
|
|
EZHENEDELNOE @map("Еженедельное")
|
|
EZHEMESYACHNOE @map("Ежемесячное")
|
|
POLUGODOVOE @map("Полугодовое")
|
|
GODOVOE @map("Годовое")
|
|
}
|
|
|
|
enum Role {
|
|
ISPOLNITEL @map("Исполнитель")
|
|
PODPISANT @map("Подписант")
|
|
POLZOVATEL @map("Пользователь")
|
|
}
|
|
|
|
enum CategoryPart {
|
|
RASKHODNIK @map("Расходник")
|
|
ZAPCHAST @map("Запчасть")
|
|
INSTRUMENT @map("Инструмент")
|
|
SPETSODEZHDA @map("Спецодежда")
|
|
}
|
|
|
|
enum EquipmentType {
|
|
PROIZVODSTVENNOE @map("Производственное")
|
|
ENERGETICHESKOE @map("Энергетическое")
|
|
NASOSNOE @map("Насосное")
|
|
KOMPRESSORNOE @map("Компрессорное")
|
|
}
|
|
|
|
model Equipment {
|
|
id String @id @default(uuid())
|
|
name String
|
|
serialNumber String
|
|
inventoryNumber String @unique
|
|
equipmentType EquipmentType
|
|
dateOfInspection DateTime?
|
|
periodicityTO EnumPeriodicityTO
|
|
location String?
|
|
status EquipmentStatus
|
|
commissionedAt DateTime?
|
|
totalEngineHours Decimal?
|
|
engineHoursSinceLastRepair Decimal?
|
|
lastRepairAt DateTime?
|
|
notes String?
|
|
workAsPartOf laborOperation?
|
|
fuelConsumed Float?
|
|
}
|
|
|
|
model Employee {
|
|
code String @id
|
|
fullName String
|
|
role Role
|
|
position String
|
|
bossCode String?
|
|
boss Employee? @relation("EmployeeBoss", fields: [bossCode], references: [code])
|
|
subordinates Employee[] @relation("EmployeeBoss")
|
|
price Float?
|
|
phoneNumber Float?
|
|
categoryResources CategoryResource[]
|
|
}
|
|
|
|
model Part {
|
|
id String @id @default(uuid())
|
|
name String
|
|
categories CategoryPart?
|
|
price Float?
|
|
description String?
|
|
serialNumber String?
|
|
categoryResources CategoryResource[]
|
|
}
|
|
|
|
model CategoryResource {
|
|
id String @id @default(uuid())
|
|
partId String?
|
|
employeeCode String?
|
|
part Part? @relation(fields: [partId], references: [id])
|
|
employee Employee? @relation(fields: [employeeCode], references: [code])
|
|
}
|