big chungus; big changes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user