Current state
This commit is contained in:
@ -5,36 +5,36 @@
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "mysql"
|
||||
url = env("DATABASE_URL")
|
||||
provider = "mysql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
|
||||
// https://github.com/pantharshit00/prisma-docs-generator
|
||||
generator docs {
|
||||
provider = "node node_modules/prisma-docs-generator"
|
||||
output = "../docs"
|
||||
provider = "node node_modules/prisma-docs-generator"
|
||||
output = "../docs"
|
||||
}
|
||||
|
||||
// https://github.com/notiz-dev/prisma-dbml-generator
|
||||
// Viewer: https://dbdiagram.io/d
|
||||
generator dbml {
|
||||
provider = "prisma-dbml-generator"
|
||||
output = "../docs"
|
||||
outputName = "schema.dbml"
|
||||
projectName = "AssetFlow"
|
||||
provider = "prisma-dbml-generator"
|
||||
output = "../docs"
|
||||
outputName = "schema.dbml"
|
||||
projectName = "AssetFlow"
|
||||
}
|
||||
|
||||
|
||||
enum contentType {
|
||||
voice_alarm
|
||||
voice_explainer
|
||||
voice_acknowledgement
|
||||
voice_ending
|
||||
voice_alarm
|
||||
voice_explainer
|
||||
voice_acknowledgement
|
||||
voice_ending
|
||||
}
|
||||
|
||||
enum alertType {
|
||||
@ -45,55 +45,72 @@ enum alertType {
|
||||
clear
|
||||
}
|
||||
|
||||
|
||||
model AlarmContacts {
|
||||
id Int @id @unique @default(autoincrement())
|
||||
name String
|
||||
phone String @unique
|
||||
comment String?
|
||||
Prios Priorities[]
|
||||
enum alertState {
|
||||
incomming // Incomming alerts
|
||||
running // Started calling
|
||||
failed // Failed to get acknowledgement of any alertContacts
|
||||
acknowledged // Some user acknowledged alert
|
||||
}
|
||||
|
||||
model Priorities {
|
||||
id Int @id @unique @default(autoincrement())
|
||||
Contact AlarmContacts @relation(fields: [contactId], references: [id])
|
||||
contactId Int
|
||||
priority Int
|
||||
actionplan ActionPlan @relation(fields: [actionplanId], references: [id])
|
||||
actionplanId Int
|
||||
|
||||
@@unique([priority, actionplanId]) // TODO: Does this work with sqlite???
|
||||
}
|
||||
|
||||
model ActionPlan {
|
||||
id Int @id @unique @default(autoincrement())
|
||||
name String
|
||||
comment String?
|
||||
prio Priorities[]
|
||||
content Content[] // aka. all voice files
|
||||
Alerts Alerts[]
|
||||
}
|
||||
|
||||
model Content {
|
||||
id Int @id @unique @default(autoincrement())
|
||||
type contentType
|
||||
name String
|
||||
filename String
|
||||
actionplan ActionPlan[]
|
||||
}
|
||||
|
||||
model Alerts {
|
||||
model alerts {
|
||||
id Int @id @unique @default(autoincrement())
|
||||
type alertType
|
||||
message String?
|
||||
actionplan ActionPlan? @relation(fields: [actionplanId], references: [id])
|
||||
actionplan actionPlan? @relation(fields: [actionplanId], references: [id])
|
||||
actionplanId Int?
|
||||
// TODO: TBD
|
||||
// Quelle: BMA / EMA
|
||||
// Date
|
||||
// Date (Clear) ???
|
||||
date DateTime
|
||||
state alertState
|
||||
acknowledged_by alertContacts[]
|
||||
acknowledged_at DateTime?
|
||||
@@fulltext([message])
|
||||
|
||||
}
|
||||
|
||||
|
||||
model alertContacts {
|
||||
id Int @id @unique @default(autoincrement())
|
||||
name String
|
||||
phone String @unique
|
||||
comment String?
|
||||
prios priorities[]
|
||||
alerts alerts[]
|
||||
@@fulltext([name, phone, comment])
|
||||
}
|
||||
|
||||
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])
|
||||
}
|
||||
|
||||
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])
|
||||
}
|
||||
|
||||
model content {
|
||||
id Int @id @unique @default(autoincrement())
|
||||
type contentType
|
||||
name String
|
||||
filename String
|
||||
actionplan actionPlan[]
|
||||
@@fulltext([name, filename])
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// https://spacecdn.de/file/bma_stoe_v1.mp3
|
||||
// https://spacecdn.de/file/quittiert_v1.mp3
|
||||
// https://spacecdn.de/file/angenehmen_tag_v1.mp3
|
||||
|
Reference in New Issue
Block a user