220 lines
6.4 KiB
Plaintext
220 lines
6.4 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model ResetToken {
|
|
id Int @id @default(autoincrement())
|
|
token String @unique
|
|
expiration DateTime
|
|
usedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
userId Int
|
|
creatorId Int
|
|
creator User @relation("resettoken_to_creator", fields: [creatorId], references: [id])
|
|
user User @relation("resettoken_to_user", fields: [userId], references: [id])
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
lastLogin DateTime?
|
|
lastLoginPrior DateTime?
|
|
roles Json?
|
|
groups Json?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
accountExpires String?
|
|
badPasswordTime String?
|
|
badPwdCount String?
|
|
cn String?
|
|
department String?
|
|
description String?
|
|
displayName String?
|
|
distinguishedName String?
|
|
dn String?
|
|
extensionAttribute1 String?
|
|
extensionAttribute10 String?
|
|
extensionAttribute2 String?
|
|
extensionAttribute6 String?
|
|
extensionAttribute7 String?
|
|
givenName String?
|
|
homeDirectory String?
|
|
homeDrive String?
|
|
lastLogoff String?
|
|
lastLogon String?
|
|
lastLogonTimestamp String?
|
|
lockoutTime String?
|
|
logonCount String?
|
|
mail String?
|
|
name String?
|
|
objectCategory String?
|
|
objectGUID String?
|
|
objectSid String?
|
|
primaryGroupID String?
|
|
pwdLastSet DateTime?
|
|
sAMAccountName String @unique
|
|
sAMAccountType String?
|
|
sn String?
|
|
thumbnailPhoto String?
|
|
title String?
|
|
userAccountControl String?
|
|
userPrincipalName String?
|
|
whenChanged String?
|
|
whenCreated String?
|
|
PAHost PAHost[] @relation("pahost_to_user")
|
|
createdTokens ResetToken[] @relation("resettoken_to_creator")
|
|
tokens ResetToken[] @relation("resettoken_to_user")
|
|
ownedWifiDevices WifiDevice[] @relation("wifidevice_to_owner")
|
|
wifiDevices WifiDevice[] @relation("wifidevice_to_user")
|
|
|
|
@@index([id, sAMAccountName])
|
|
}
|
|
|
|
model WifiDevice {
|
|
id Int @id @default(autoincrement())
|
|
oui String?
|
|
mac String @unique
|
|
hostname String?
|
|
firstSeen DateTime? @default(now())
|
|
lastSeen DateTime?
|
|
essid String?
|
|
ip String?
|
|
apName String?
|
|
status Status?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
userId Int?
|
|
controller String @default("unknown")
|
|
accessPointId Int?
|
|
frequency String?
|
|
identity String?
|
|
name String?
|
|
notes String?
|
|
ownerId Int?
|
|
protocol String?
|
|
signalStrength Int?
|
|
speed Int?
|
|
usage BigInt?
|
|
uptime Int?
|
|
networkId Int?
|
|
network Network? @relation(fields: [networkId], references: [id])
|
|
accessPoint AccessPoint? @relation("wifidevice_to_ap", fields: [accessPointId], references: [id])
|
|
owner User? @relation("wifidevice_to_owner", fields: [ownerId], references: [id])
|
|
user User? @relation("wifidevice_to_user", fields: [userId], references: [id])
|
|
}
|
|
|
|
model Log {
|
|
id Int @id @default(autoincrement())
|
|
timestamp DateTime @default(now())
|
|
level LogLevel @default(LOW)
|
|
tags String?
|
|
message String
|
|
data Json?
|
|
|
|
@@index([timestamp(sort: Desc)])
|
|
}
|
|
|
|
model PAHost {
|
|
id Int @id @default(autoincrement())
|
|
user String
|
|
description String
|
|
cidr String @unique
|
|
encryptedKey String
|
|
note String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
ownerId Int
|
|
owner User @relation("pahost_to_user", fields: [ownerId], references: [id])
|
|
}
|
|
|
|
model AccessPoint {
|
|
id Int @id @default(autoincrement())
|
|
mac String @unique
|
|
hostname String @unique
|
|
name String?
|
|
local String?
|
|
notes String?
|
|
controller String?
|
|
model String?
|
|
ip String?
|
|
clients Int?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
encryptedSshPassword String?
|
|
encryptedSshUser String?
|
|
inventoryTag String?
|
|
usage BigInt?
|
|
uptime Int?
|
|
uplinkSpeed Int?
|
|
stats AccessPointStats[] @relation("accesspointstats_to_ap")
|
|
wifiDevices WifiDevice[] @relation("wifidevice_to_ap")
|
|
|
|
network Network? @relation(fields: [networkId], references: [id])
|
|
networkId Int?
|
|
}
|
|
|
|
model AccessPointStats {
|
|
id Int @id @default(autoincrement())
|
|
timestamp DateTime @default(now())
|
|
clients Int?
|
|
avgSignalStrength Int?
|
|
minSignalStrength Int?
|
|
maxSignalStrength Int?
|
|
avgSpeed Int?
|
|
minSpeed Int?
|
|
maxSpeed Int?
|
|
avgClientUptime Int?
|
|
maxClientUptime Int?
|
|
avgUsage BigInt?
|
|
sumUsage BigInt?
|
|
accessPointId Int
|
|
accessPoint AccessPoint @relation("accesspointstats_to_ap", fields: [accessPointId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([timestamp(sort: Desc)])
|
|
}
|
|
|
|
model NetworkStats {
|
|
id Int @id @default(autoincrement())
|
|
timestamp DateTime @default(now())
|
|
clients Int?
|
|
avgUsage BigInt?
|
|
sumUsage BigInt?
|
|
networkId Int
|
|
network Network @relation(fields: [networkId], references: [id])
|
|
|
|
@@index([timestamp(sort: Desc)])
|
|
}
|
|
|
|
model Network {
|
|
id Int @id @default(autoincrement())
|
|
name String @unique
|
|
shortName String @unique
|
|
cidr String @unique
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
NetworkStats NetworkStats[]
|
|
WifiDevice WifiDevice[]
|
|
AccessPoint AccessPoint[]
|
|
|
|
@@index([id])
|
|
}
|
|
|
|
enum Status {
|
|
ONLINE
|
|
RECENT
|
|
OFFLINE
|
|
}
|
|
|
|
enum LogLevel {
|
|
LOW
|
|
INFO
|
|
SUCCESS
|
|
WARNING
|
|
ERROR
|
|
}
|