schema updates

This commit is contained in:
Leon Meier 2025-02-03 22:23:37 +01:00
parent 2e8ee7ca5c
commit 8383080395
3 changed files with 78 additions and 43 deletions

View File

@ -16,3 +16,34 @@ Funktionen:
- Erklärung MP3 - Erklärung MP3
- Quittierung MP3 - Quittierung MP3
- Verabschiedung MP3 - Verabschiedung MP3
## API Endpoint planning
alertContacts (CRUD Fully implemented)
alerts -> Only get
actionPlan (CRUD)
- select all prios
priorities (CRUD)
- select actionPlan
- Only allow changes to priority
content (CRUD)
- Howto handle upload?
POST /alert/[:alert_hook]
-> Check actionplan if hook exists and select current prios -> Write call request to XYXYX
1. create one or more alertContacts
2. create 4x content (all phases)
3. create actionplan with contents
4. create one or more priorities

View File

@ -2,7 +2,7 @@
//// THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) //// THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
//// ------------------------------------------------------ //// ------------------------------------------------------
Project "AssetFlow" { Project "ATAS" {
database_type: '' database_type: ''
Note: '' Note: ''
} }
@ -10,11 +10,11 @@ Project "AssetFlow" {
Table alerts { Table alerts {
id Int [pk, increment] id Int [pk, increment]
type alertType [not null] type alertType [not null]
message String state alertState [not null]
description String
date DateTime [not null]
actionplan actionPlan actionplan actionPlan
actionplanId Int actionplanId Int
date DateTime [not null]
state alertState [not null]
acknowledged_by alertContacts [not null] acknowledged_by alertContacts [not null]
acknowledged_at DateTime acknowledged_at DateTime
} }
@ -30,9 +30,9 @@ Table alertContacts {
Table actionPlan { Table actionPlan {
id Int [pk, increment] id Int [pk, increment]
name String [not null] name String [unique, not null]
comment String comment String
alert_hook String [unique, not null] alerthook String [unique, not null]
prio priorities [not null] prio priorities [not null]
content content [not null] content content [not null]
alerts alerts [not null] alerts alerts [not null]
@ -85,7 +85,7 @@ Enum alertType {
} }
Enum alertState { Enum alertState {
incomming incoming
running running
failed failed
acknowledged acknowledged

View File

@ -26,7 +26,7 @@ generator dbml {
provider = "prisma-dbml-generator" provider = "prisma-dbml-generator"
output = "../docs" output = "../docs"
outputName = "schema.dbml" outputName = "schema.dbml"
projectName = "AssetFlow" projectName = "ATAS"
} }
@ -46,7 +46,7 @@ enum alertType {
} }
enum alertState { enum alertState {
incomming // Incomming alerts incoming // Incoming alerts
running // Started calling running // Started calling
failed // Failed to get acknowledgement of any alertContacts failed // Failed to get acknowledgement of any alertContacts
acknowledged // Some user acknowledged alert acknowledged // Some user acknowledged alert
@ -55,16 +55,19 @@ enum alertState {
model alerts { model alerts {
id Int @id @unique @default(autoincrement()) id Int @id @unique @default(autoincrement())
type alertType type alertType
message String? state alertState
description String?
date DateTime
actionplan actionPlan? @relation(fields: [actionplanId], references: [id]) actionplan actionPlan? @relation(fields: [actionplanId], references: [id])
actionplanId Int? actionplanId Int?
date DateTime
state alertState
acknowledged_by alertContacts[] acknowledged_by alertContacts[]
acknowledged_at DateTime? acknowledged_at DateTime?
@@fulltext([message])
}
@@fulltext([description])
}
model alertContacts { model alertContacts {
id Int @id @unique @default(autoincrement()) id Int @id @unique @default(autoincrement())
@ -73,17 +76,20 @@ model alertContacts {
comment String? comment String?
prios priorities[] prios priorities[]
alerts alerts[] alerts alerts[]
@@fulltext([name, phone, comment]) @@fulltext([name, phone, comment])
} }
model actionPlan { model actionPlan {
id Int @id @unique @default(autoincrement()) id Int @id @unique @default(autoincrement())
name String name String @unique
comment String? comment String?
alert_hook String @unique alerthook String @unique
prio priorities[] prio priorities[]
content content[] // aka. all voice files content content[] // aka. all voice files
alerts alerts[] alerts alerts[]
@@fulltext([name, comment]) @@fulltext([name, comment])
} }
@ -104,12 +110,10 @@ model content {
name String name String
filename String filename String
actionplan actionPlan[] actionplan actionPlan[]
@@fulltext([name, filename]) @@fulltext([name, filename])
} }
// https://spacecdn.de/file/bma_stoe_v1.mp3 // https://spacecdn.de/file/bma_stoe_v1.mp3
// https://spacecdn.de/file/quittiert_v1.mp3 // https://spacecdn.de/file/quittiert_v1.mp3
// https://spacecdn.de/file/angenehmen_tag_v1.mp3 // https://spacecdn.de/file/angenehmen_tag_v1.mp3