big chungus; big changes

This commit is contained in:
2025-10-22 15:01:08 -04:00
parent bb515f1219
commit 390f637c48
33 changed files with 907 additions and 1783 deletions

View File

@@ -14,61 +14,34 @@ datasource db {
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
username String @unique
password String
owner Boolean
userPerms UserPerm[]
}
model Namespace {
id Int @id @default(autoincrement())
name String
UserPerm UserPerm[]
AlarmGroup AlarmGroup[]
}
model UserPerm {
permission Permission
// User FK
userId Int
user User @relation(fields: [userId], references: [id])
// Namespace FK
namespaceId Int
namespace Namespace @relation(fields: [namespaceId], references: [id])
@@id([userId, namespaceId])
}
enum Permission {
snoozer
shutter
manager
}
model AlarmGroup {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
name String
zone String
state AlarmGroupState
Alarm Alarm[]
// Namespace FK
NamespaceId Int
Namespace Namespace @relation(fields: [NamespaceId], references: [id])
Alarm Alarm[]
mo Boolean
tu Boolean
we Boolean
th Boolean
fr Boolean
sa Boolean
su Boolean
repeats Boolean
}
enum AlarmGroupState {
idle
handle
snooze
stop
ringing
}
model Alarm {
id Int @id @default(autoincrement())
name String
id Int @id @default(autoincrement())
time String
nextRing DateTime
// AlarmGroup FK
AlarmGroupId Int