2025-01-14 23:15:37 +01:00
|
|
|
// This is your Prisma schema file,
|
|
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
|
|
|
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
|
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
|
|
|
|
|
|
generator client {
|
2025-01-17 23:02:39 +01:00
|
|
|
provider = "prisma-client-js"
|
2025-01-14 23:15:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
2025-01-17 23:02:39 +01:00
|
|
|
provider = "mysql"
|
|
|
|
url = env("DATABASE_URL")
|
2025-01-14 23:15:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/pantharshit00/prisma-docs-generator
|
|
|
|
generator docs {
|
2025-01-17 23:02:39 +01:00
|
|
|
provider = "node node_modules/prisma-docs-generator"
|
|
|
|
output = "../docs"
|
2025-01-14 23:15:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// https://github.com/notiz-dev/prisma-dbml-generator
|
|
|
|
// Viewer: https://dbdiagram.io/d
|
|
|
|
generator dbml {
|
2025-01-17 23:02:39 +01:00
|
|
|
provider = "prisma-dbml-generator"
|
|
|
|
output = "../docs"
|
|
|
|
outputName = "schema.dbml"
|
|
|
|
projectName = "AssetFlow"
|
2025-01-14 23:15:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum contentType {
|
2025-01-17 23:02:39 +01:00
|
|
|
voice_alarm
|
|
|
|
voice_explainer
|
|
|
|
voice_acknowledgement
|
|
|
|
voice_ending
|
2025-01-14 23:15:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
enum alertType {
|
|
|
|
generic
|
|
|
|
fire
|
|
|
|
fault
|
|
|
|
intrusion
|
|
|
|
clear
|
|
|
|
}
|
|
|
|
|
2025-01-17 23:02:39 +01:00
|
|
|
enum alertState {
|
|
|
|
incomming // Incomming alerts
|
|
|
|
running // Started calling
|
|
|
|
failed // Failed to get acknowledgement of any alertContacts
|
|
|
|
acknowledged // Some user acknowledged alert
|
|
|
|
}
|
|
|
|
|
|
|
|
model alerts {
|
|
|
|
id Int @id @unique @default(autoincrement())
|
|
|
|
type alertType
|
|
|
|
message String?
|
|
|
|
actionplan actionPlan? @relation(fields: [actionplanId], references: [id])
|
|
|
|
actionplanId Int?
|
|
|
|
date DateTime
|
|
|
|
state alertState
|
|
|
|
acknowledged_by alertContacts[]
|
|
|
|
acknowledged_at DateTime?
|
|
|
|
@@fulltext([message])
|
2025-01-14 23:15:37 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-01-17 23:02:39 +01:00
|
|
|
model alertContacts {
|
|
|
|
id Int @id @unique @default(autoincrement())
|
|
|
|
name String
|
|
|
|
phone String @unique
|
|
|
|
comment String?
|
|
|
|
prios priorities[]
|
|
|
|
alerts alerts[]
|
|
|
|
@@fulltext([name, phone, comment])
|
2025-01-14 23:15:37 +01:00
|
|
|
}
|
|
|
|
|
2025-01-17 23:02:39 +01:00
|
|
|
model actionPlan {
|
|
|
|
id Int @id @unique @default(autoincrement())
|
|
|
|
name String
|
|
|
|
comment String?
|
|
|
|
alert_hook String @unique
|
|
|
|
prio priorities[]
|
|
|
|
content content[] // aka. all voice files
|
|
|
|
alerts alerts[]
|
|
|
|
@@fulltext([name, comment])
|
2025-01-14 23:15:37 +01:00
|
|
|
}
|
|
|
|
|
2025-01-17 23:02:39 +01:00
|
|
|
model priorities {
|
|
|
|
id Int @id @unique @default(autoincrement())
|
|
|
|
Contact alertContacts @relation(fields: [contactId], references: [id])
|
|
|
|
contactId Int
|
|
|
|
priority Int
|
|
|
|
actionplan actionPlan @relation(fields: [actionplanId], references: [id])
|
|
|
|
actionplanId Int
|
|
|
|
|
|
|
|
@@unique([priority, actionplanId])
|
2025-01-14 23:15:37 +01:00
|
|
|
}
|
|
|
|
|
2025-01-17 23:02:39 +01:00
|
|
|
model content {
|
|
|
|
id Int @id @unique @default(autoincrement())
|
|
|
|
type contentType
|
|
|
|
name String
|
|
|
|
filename String
|
|
|
|
actionplan actionPlan[]
|
|
|
|
@@fulltext([name, filename])
|
2025-01-14 23:15:37 +01:00
|
|
|
}
|
|
|
|
|
2025-01-17 23:02:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-14 23:15:37 +01:00
|
|
|
// https://spacecdn.de/file/bma_stoe_v1.mp3
|
|
|
|
// https://spacecdn.de/file/quittiert_v1.mp3
|
|
|
|
// https://spacecdn.de/file/angenehmen_tag_v1.mp3
|
|
|
|
// https://spacecdn.de/file/erklaerung_v1.mp3
|