ifms-pti/server/prisma/schema.prisma

161 lines
4.3 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
userId Int
creatorId Int
2020-12-15 20:01:39 +00:00
creator User @relation("resettoken_to_creator", fields: [creatorId], references: [id])
user User @relation("resettoken_to_user", fields: [userId], references: [id])
2020-11-06 20:34:32 +00:00
}
model User {
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?
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?
2020-11-10 20:35:54 +00:00
pwdLastSet DateTime?
2020-11-06 20:34:32 +00:00
sAMAccountName String @unique
sAMAccountType String?
sn String?
thumbnailPhoto String?
title String?
userAccountControl String?
userPrincipalName String?
whenChanged String?
whenCreated String?
2020-11-20 19:16:38 +00:00
createdTokens ResetToken[] @relation("resettoken_to_creator")
tokens ResetToken[] @relation("resettoken_to_user")
wifiDevices WifiDevice[] @relation("wifidevice_to_user")
2021-01-18 19:41:19 +00:00
PAHost PAHost[] @relation("pahost_to_user")
2020-11-06 20:34:32 +00:00
}
model WifiDevice {
2022-03-24 16:31:56 +00:00
id Int @id @default(autoincrement())
oui String?
mac String @unique
hostname String?
firstSeen DateTime? @default(now())
lastSeen DateTime?
essid String?
ip String?
uptime String?
apName String?
accessPointId Int?
accessPoint AccessPoint? @relation("wifidevice_to_ap", fields: [accessPointId], references: [id])
status Status?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId Int?
controller String @default("unknown")
user User? @relation("wifidevice_to_user", fields: [userId], 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
}
model Statistic {
id Int @id @default(autoincrement())
timestamp DateTime @default(now())
onlineUsers Int
offlineUsers Int
totalUsers Int
totalWifiDevices Int
onlineWifiDevices Int
}
2021-01-14 14:07:19 +00:00
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 {
id Int @id @default(autoincrement())
mac String @unique
hostname String @unique
name String?
local String?
notes String?
uptime String?
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
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
2022-03-24 18:26:57 +00:00
wifiDevices WifiDevice[] @relation("wifidevice_to_ap")
2022-03-24 16:31:56 +00:00
}