ifms-pti/server/prisma/schema.prisma

214 lines
5.2 KiB
Plaintext
Raw Normal View History

2020-11-06 20:34:32 +00:00
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
2022-06-02 17:15:22 +00:00
userId Int
user User @relation("resettoken_to_user", fields: [userId], references: [id])
creatorId Int
creator User @relation("resettoken_to_creator", fields: [creatorId], references: [id])
2020-11-06 20:34:32 +00:00
}
model User {
2022-06-02 17:15:22 +00:00
id Int @id @default(autoincrement())
2020-12-21 15:33:35 +00:00
lastLogin DateTime?
lastLoginPrior DateTime?
2020-11-06 20:34:32 +00:00
roles Json?
groups Json?
2022-06-02 17:15:22 +00:00
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
2020-11-06 20:34:32 +00:00
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?
2020-11-10 20:35:54 +00:00
pwdLastSet DateTime?
2022-06-02 17:15:22 +00:00
sAMAccountName String @unique
2020-11-06 20:34:32 +00:00
sAMAccountType String?
sn String?
thumbnailPhoto String?
title String?
userAccountControl String?
userPrincipalName String?
whenChanged String?
whenCreated String?
2022-06-02 17:15:22 +00:00
createdTokens ResetToken[] @relation("resettoken_to_creator")
tokens ResetToken[] @relation("resettoken_to_user")
wifiDevices WifiDevice[] @relation("wifidevice_to_user")
ownedWifiDevices WifiDevice[] @relation("wifidevice_to_owner")
PAHost PAHost[] @relation("pahost_to_user")
2020-11-06 20:34:32 +00:00
}
model WifiDevice {
2022-06-02 17:15:22 +00:00
id Int @id @default(autoincrement())
oui String?
mac String @unique
hostname String?
firstSeen DateTime? @default(now())
lastSeen DateTime?
ip String?
2022-06-03 12:54:39 +00:00
name String?
notes String?
2022-06-02 17:15:22 +00:00
essid String?
2022-06-14 13:26:01 +00:00
uptime Int?
2022-06-02 17:15:22 +00:00
apName String?
signalStrength Int?
frequency String?
protocol String?
speed Int?
2022-06-14 13:26:01 +00:00
usage BigInt?
2022-06-02 17:15:22 +00:00
status Status?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
controller String @default("unknown")
identity String? // The user informed by the controller
2022-03-24 16:31:56 +00:00
accessPointId Int?
accessPoint AccessPoint? @relation("wifidevice_to_ap", fields: [accessPointId], references: [id])
2022-06-02 17:15:22 +00:00
userId Int? // The connected User
user User? @relation("wifidevice_to_user", fields: [userId], references: [id])
ownerId Int? // The owner of the device
owner User? @relation("wifidevice_to_owner", fields: [ownerId], references: [id])
2020-11-06 20:34:32 +00:00
}
enum Status {
ONLINE
2020-12-17 17:47:43 +00:00
RECENT
2020-11-06 20:34:32 +00:00
OFFLINE
}
2020-12-17 17:47:43 +00:00
model Log {
id Int @id @default(autoincrement())
timestamp DateTime @default(now())
level LogLevel @default(LOW)
2021-01-05 18:23:28 +00:00
tags String?
2020-12-17 17:47:43 +00:00
message String
data Json?
}
enum LogLevel {
LOW
INFO
SUCCESS
WARNING
ERROR
}
2021-01-14 19:12:37 +00:00
model PAHost {
2021-01-14 14:07:19 +00:00
id Int @id @default(autoincrement())
2021-01-14 17:04:41 +00:00
user String
2021-01-14 14:07:19 +00:00
description String
2021-01-14 19:12:37 +00:00
cidr String @unique
2021-01-14 14:07:19 +00:00
encryptedKey String
note String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
2021-01-18 19:41:19 +00:00
ownerId Int
owner User @relation("pahost_to_user", fields: [ownerId], references: [id])
2021-01-14 14:07:19 +00:00
}
2022-03-24 16:31:56 +00:00
model AccessPoint {
2022-06-02 17:15:22 +00:00
id Int @id @default(autoincrement())
mac String @unique
hostname String @unique
name String?
local String?
notes String?
inventoryTag String?
2022-06-14 13:26:01 +00:00
uptime Int?
2022-03-24 16:31:56 +00:00
controller String?
model String?
2022-03-24 18:26:57 +00:00
ip String?
2022-03-24 17:24:58 +00:00
clients Int?
2022-03-24 16:31:56 +00:00
2022-06-14 13:26:01 +00:00
usage BigInt?
2022-06-08 18:32:56 +00:00
encryptedSshUser String?
encryptedSshPassword String?
2022-06-02 17:15:22 +00:00
2022-03-24 16:31:56 +00:00
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
wifiDevices WifiDevice[] @relation("wifidevice_to_ap")
stats AccessPointStats[] @relation("accesspointstats_to_ap")
2022-06-02 17:15:22 +00:00
}
model AccessPointStats {
2022-06-08 18:32:56 +00:00
id Int @id @default(autoincrement())
timestamp DateTime @default(now())
clients Int?
2022-06-14 13:26:01 +00:00
avgSignalStrength Int?
minSignalStrength Int?
maxSignalStrength Int?
2022-06-08 18:32:56 +00:00
avgSpeed Int?
minSpeed Int?
maxSpeed Int?
avgClientUptime Int?
maxClientUptime Int?
2022-06-14 13:26:01 +00:00
avgUsage BigInt?
sumUsage BigInt?
2022-06-08 18:32:56 +00:00
2022-06-02 17:15:22 +00:00
accessPointId Int
accessPoint AccessPoint @relation("accesspointstats_to_ap", fields: [accessPointId], references: [id])
2022-06-02 17:15:22 +00:00
}
model Network {
id Int @id @default(autoincrement())
name String @unique
shortName String @unique
cidr String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
2022-03-24 16:31:56 +00:00
}