ifms-printer-manager/prisma/schema.prisma

85 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2023-06-15 11:39:13 +00:00
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum Role {
ADMIN // SERTI
INSPECTOR // Fiscal de contrato
USER // Usuário
}
model User {
id Int @id @default(autoincrement())
username String? @unique
mail String?
displayName String?
thumbnailPhoto String?
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
2023-06-21 17:48:40 +00:00
campus String?
2023-06-15 11:39:13 +00:00
roles Role[] @default([USER])
}
2023-06-15 12:04:59 +00:00
model Printer {
id Int @id @default(autoincrement())
friendlyName String?
2023-06-20 13:13:28 +00:00
location String?
2023-06-15 19:55:09 +00:00
2023-06-26 12:15:20 +00:00
serialNumber String @unique
ip String @unique
2023-06-20 19:21:28 +00:00
model String
2023-06-15 12:04:59 +00:00
2023-06-15 19:55:09 +00:00
blackTonerModel String?
cyanTonerModel String?
magentaTonerModel String?
yellowTonerModel String?
2023-06-15 12:04:59 +00:00
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
2023-06-15 19:55:09 +00:00
2023-06-21 17:48:40 +00:00
status PrinterStatus[]
network Network @relation(fields: [networkId], references: [id])
networkId Int
2023-06-15 12:04:59 +00:00
}
2023-06-15 19:55:09 +00:00
model PrinterStatus {
id Int @id @default(autoincrement())
tonerBlackLevel Int
tonerCyanLevel Int?
tonerMagentaLevel Int?
tonerYellowLevel Int?
counter Int
2023-06-21 17:48:40 +00:00
timestamp DateTime @default(now())
2023-06-15 19:55:09 +00:00
printerId Int
2023-06-20 19:21:28 +00:00
printer Printer @relation(fields: [printerId], references: [id], onDelete: Cascade)
2023-06-21 17:48:40 +00:00
@@index([timestamp])
}
model Network {
id Int @id @default(autoincrement())
name String @unique
shortName String @unique
cidr String @unique
printers Printer[]
@@index([id])
2023-06-15 19:55:09 +00:00
}