Update Prisma

This commit is contained in:
Douglas Barone 2022-08-30 07:33:05 -04:00
parent c9307e4273
commit 549324851a
3 changed files with 4866 additions and 5769 deletions

10432
server/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/douglasvbarone/ifms-gql-server.git"
"url": "git+https://github.com/douglasvbarone/ifms-portal-de-ti.git"
},
"keywords": [
"ifms"
@ -27,9 +27,9 @@
"author": "Douglas Barone",
"license": "ISC",
"bugs": {
"url": "https://github.com/douglasvbarone/ifms-gql-server/issues"
"url": "https://github.com/douglasvbarone/ifms-portal-de-ti/issues"
},
"homepage": "https://github.com/douglasvbarone/ifms-gql-server#readme",
"homepage": "https://github.com/douglasvbarone/ifms-portal-de-ti#readme",
"devDependencies": {
"@babel/cli": "^7.16.0",
"@babel/core": "^7.16.0",
@ -37,10 +37,10 @@
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"nodemon": "^2.0.15",
"prisma": "^3.15.2"
"prisma": "^4.2.1"
},
"dependencies": {
"@prisma/client": "^3.15.2",
"@prisma/client": "^4.2.1",
"activedirectory2": "^2.1.0",
"apollo-server": "^2.19.0",
"apollo-server-plugin-response-cache": "^0.5.6",

View File

@ -14,22 +14,20 @@ model ResetToken {
usedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId Int
user User @relation("resettoken_to_user", fields: [userId], references: [id])
creatorId Int
creator User @relation("resettoken_to_creator", fields: [creatorId], references: [id])
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())
id Int @id @default(autoincrement())
lastLogin DateTime?
lastLoginPrior DateTime?
roles Json?
groups Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
accountExpires String?
badPasswordTime String?
badPwdCount String?
@ -59,7 +57,7 @@ model User {
objectSid String?
primaryGroupID String?
pwdLastSet DateTime?
sAMAccountName String @unique
sAMAccountName String @unique
sAMAccountType String?
sn String?
thumbnailPhoto String?
@ -68,56 +66,42 @@ model User {
userPrincipalName String?
whenChanged String?
whenCreated String?
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")
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")
}
model WifiDevice {
id Int @id @default(autoincrement())
oui String?
mac String @unique
hostname String?
firstSeen DateTime? @default(now())
lastSeen DateTime?
ip String?
name String?
notes String?
id Int @id @default(autoincrement())
oui String?
mac String @unique
hostname String?
firstSeen DateTime? @default(now())
lastSeen DateTime?
essid String?
uptime Int?
ip String?
apName String?
signalStrength Int?
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?
status Status?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
controller String @default("unknown")
identity String? // The user informed by the controller
accessPointId Int?
accessPoint AccessPoint? @relation("wifidevice_to_ap", fields: [accessPointId], references: [id], onDelete: SetNull)
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])
}
enum Status {
ONLINE
RECENT
OFFLINE
uptime Int?
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 {
@ -129,14 +113,6 @@ model Log {
data Json?
}
enum LogLevel {
LOW
INFO
SUCCESS
WARNING
ERROR
}
model PAHost {
id Int @id @default(autoincrement())
user String
@ -146,68 +122,69 @@ model PAHost {
note String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
ownerId Int
owner User @relation("pahost_to_user", fields: [ownerId], references: [id])
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?
inventoryTag String?
uptime Int?
controller String?
model String?
ip String?
clients Int?
usage BigInt?
encryptedSshUser String?
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?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
wifiDevices WifiDevice[] @relation("wifidevice_to_ap")
stats AccessPointStats[] @relation("accesspointstats_to_ap")
encryptedSshUser String?
inventoryTag String?
usage BigInt?
uptime Int?
stats AccessPointStats[] @relation("accesspointstats_to_ap")
wifiDevices WifiDevice[] @relation("wifidevice_to_ap")
}
model AccessPointStats {
id Int @id @default(autoincrement())
timestamp DateTime @default(now())
clients Int?
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)
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)
}
model Network {
id Int @id @default(autoincrement())
name String @unique
shortName String @unique
cidr String @unique
id Int @id @default(autoincrement())
name String @unique
shortName String @unique
cidr String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
enum Status {
ONLINE
RECENT
OFFLINE
}
enum LogLevel {
LOW
INFO
SUCCESS
WARNING
ERROR
}