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

View File

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