Fixed DateTime properties
This commit is contained in:
parent
5d86d2785d
commit
1a69ad12e0
|
@ -1,95 +0,0 @@
|
||||||
generator client {
|
|
||||||
provider = "prisma-client-js"
|
|
||||||
}
|
|
||||||
|
|
||||||
datasource db {
|
|
||||||
provider = "postgresql"
|
|
||||||
url = "***"
|
|
||||||
}
|
|
||||||
|
|
||||||
model ResetToken {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
token String @unique
|
|
||||||
expiration DateTime
|
|
||||||
usedAt DateTime?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
user User @relation(fields: [userId], references: [id], name: "resettoken_to_user")
|
|
||||||
userId Int
|
|
||||||
creator User @relation(fields: [creatorId], references: [id], name: "resettoken_to_creator")
|
|
||||||
creatorId Int
|
|
||||||
}
|
|
||||||
|
|
||||||
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 String?
|
|
||||||
sAMAccountName String @unique
|
|
||||||
sAMAccountType String?
|
|
||||||
sn String?
|
|
||||||
thumbnailPhoto String?
|
|
||||||
title String?
|
|
||||||
userAccountControl String?
|
|
||||||
userPrincipalName String?
|
|
||||||
whenChanged String?
|
|
||||||
whenCreated String?
|
|
||||||
createdTokens ResetToken[] @relation("resettoken_to_user")
|
|
||||||
tokens ResetToken[] @relation("resettoken_to_creator")
|
|
||||||
WifiDevice WifiDevice[]
|
|
||||||
}
|
|
||||||
|
|
||||||
model WifiDevice {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
oui String?
|
|
||||||
mac String? @unique
|
|
||||||
hostname String?
|
|
||||||
firstSeen String?
|
|
||||||
lastSeen String?
|
|
||||||
essid String?
|
|
||||||
ip String?
|
|
||||||
uptime String?
|
|
||||||
apName String?
|
|
||||||
status Status?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
userId Int
|
|
||||||
user User @relation(fields: [userId], references: [id])
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Status {
|
|
||||||
ONLINE
|
|
||||||
OFFLINE
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
# Migration `20201107123940-init`
|
|
||||||
|
|
||||||
This migration has been generated by Douglas Barone at 11/7/2020, 8:39:40 AM.
|
|
||||||
You can check out the [state of the schema](./schema.prisma) after the migration.
|
|
||||||
|
|
||||||
## Database Steps
|
|
||||||
|
|
||||||
```sql
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Changes
|
|
||||||
|
|
||||||
```diff
|
|
||||||
diff --git schema.prisma schema.prisma
|
|
||||||
migration 20201106194210-init..20201107123940-init
|
|
||||||
--- datamodel.dml
|
|
||||||
+++ datamodel.dml
|
|
||||||
@@ -3,9 +3,9 @@
|
|
||||||
}
|
|
||||||
datasource db {
|
|
||||||
provider = "postgresql"
|
|
||||||
- url = "***"
|
|
||||||
+ url = "***"
|
|
||||||
}
|
|
||||||
model ResetToken {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
@@ -67,9 +67,9 @@
|
|
||||||
whenChanged String?
|
|
||||||
whenCreated String?
|
|
||||||
createdTokens ResetToken[] @relation("resettoken_to_user")
|
|
||||||
tokens ResetToken[] @relation("resettoken_to_creator")
|
|
||||||
- WifiDevice WifiDevice[]
|
|
||||||
+ WifiDevice WifiDevice[] @relation("wifidevice_to_user")
|
|
||||||
}
|
|
||||||
model WifiDevice {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
@@ -85,9 +85,9 @@
|
|
||||||
status Status?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
userId Int
|
|
||||||
- user User @relation(fields: [userId], references: [id])
|
|
||||||
+ user User @relation(fields: [userId], references: [id], name: "wifidevice_to_user")
|
|
||||||
}
|
|
||||||
enum Status {
|
|
||||||
ONLINE
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
generator client {
|
|
||||||
provider = "prisma-client-js"
|
|
||||||
}
|
|
||||||
|
|
||||||
datasource db {
|
|
||||||
provider = "postgresql"
|
|
||||||
url = "***"
|
|
||||||
}
|
|
||||||
|
|
||||||
model ResetToken {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
token String @unique
|
|
||||||
expiration DateTime
|
|
||||||
usedAt DateTime?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
user User @relation(fields: [userId], references: [id], name: "resettoken_to_user")
|
|
||||||
userId Int
|
|
||||||
creator User @relation(fields: [creatorId], references: [id], name: "resettoken_to_creator")
|
|
||||||
creatorId Int
|
|
||||||
}
|
|
||||||
|
|
||||||
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 String?
|
|
||||||
sAMAccountName String @unique
|
|
||||||
sAMAccountType String?
|
|
||||||
sn String?
|
|
||||||
thumbnailPhoto String?
|
|
||||||
title String?
|
|
||||||
userAccountControl String?
|
|
||||||
userPrincipalName String?
|
|
||||||
whenChanged String?
|
|
||||||
whenCreated String?
|
|
||||||
createdTokens ResetToken[] @relation("resettoken_to_user")
|
|
||||||
tokens ResetToken[] @relation("resettoken_to_creator")
|
|
||||||
WifiDevice WifiDevice[] @relation("wifidevice_to_user")
|
|
||||||
}
|
|
||||||
|
|
||||||
model WifiDevice {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
oui String?
|
|
||||||
mac String? @unique
|
|
||||||
hostname String?
|
|
||||||
firstSeen String?
|
|
||||||
lastSeen String?
|
|
||||||
essid String?
|
|
||||||
ip String?
|
|
||||||
uptime String?
|
|
||||||
apName String?
|
|
||||||
status Status?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
userId Int
|
|
||||||
user User @relation(fields: [userId], references: [id], name: "wifidevice_to_user")
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Status {
|
|
||||||
ONLINE
|
|
||||||
OFFLINE
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.3.14-fixed",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"tag": "CreateDirective",
|
|
||||||
"location": {
|
|
||||||
"path": {
|
|
||||||
"tag": "Field",
|
|
||||||
"model": "User",
|
|
||||||
"field": "WifiDevice"
|
|
||||||
},
|
|
||||||
"directive": "relation"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tag": "CreateArgument",
|
|
||||||
"location": {
|
|
||||||
"tag": "Directive",
|
|
||||||
"path": {
|
|
||||||
"tag": "Field",
|
|
||||||
"model": "User",
|
|
||||||
"field": "WifiDevice"
|
|
||||||
},
|
|
||||||
"directive": "relation"
|
|
||||||
},
|
|
||||||
"argument": "",
|
|
||||||
"value": "\"wifidevice_to_user\""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tag": "CreateArgument",
|
|
||||||
"location": {
|
|
||||||
"tag": "Directive",
|
|
||||||
"path": {
|
|
||||||
"tag": "Field",
|
|
||||||
"model": "WifiDevice",
|
|
||||||
"field": "user"
|
|
||||||
},
|
|
||||||
"directive": "relation"
|
|
||||||
},
|
|
||||||
"argument": "name",
|
|
||||||
"value": "\"wifidevice_to_user\""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
# Migration `20201107124332-init`
|
|
||||||
|
|
||||||
This migration has been generated by Douglas Barone at 11/7/2020, 8:43:32 AM.
|
|
||||||
You can check out the [state of the schema](./schema.prisma) after the migration.
|
|
||||||
|
|
||||||
## Database Steps
|
|
||||||
|
|
||||||
```sql
|
|
||||||
ALTER TABLE "public"."WifiDevice" ALTER COLUMN "mac" SET NOT NULL
|
|
||||||
```
|
|
||||||
|
|
||||||
## Changes
|
|
||||||
|
|
||||||
```diff
|
|
||||||
diff --git schema.prisma schema.prisma
|
|
||||||
migration 20201107123940-init..20201107124332-init
|
|
||||||
--- datamodel.dml
|
|
||||||
+++ datamodel.dml
|
|
||||||
@@ -3,9 +3,9 @@
|
|
||||||
}
|
|
||||||
datasource db {
|
|
||||||
provider = "postgresql"
|
|
||||||
- url = "***"
|
|
||||||
+ url = "***"
|
|
||||||
}
|
|
||||||
model ResetToken {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
@@ -73,9 +73,9 @@
|
|
||||||
model WifiDevice {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
oui String?
|
|
||||||
- mac String? @unique
|
|
||||||
+ mac String @unique
|
|
||||||
hostname String?
|
|
||||||
firstSeen String?
|
|
||||||
lastSeen String?
|
|
||||||
essid String?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.3.14-fixed",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"tag": "UpdateField",
|
|
||||||
"model": "WifiDevice",
|
|
||||||
"field": "mac",
|
|
||||||
"arity": "Required"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
# Migration `20201110184959-init`
|
|
||||||
|
|
||||||
This migration has been generated by Douglas Barone at 11/10/2020, 2:49:59 PM.
|
|
||||||
You can check out the [state of the schema](./schema.prisma) after the migration.
|
|
||||||
|
|
||||||
## Database Steps
|
|
||||||
|
|
||||||
```sql
|
|
||||||
ALTER TABLE "public"."WifiDevice" ALTER COLUMN "userId" DROP NOT NULL
|
|
||||||
```
|
|
||||||
|
|
||||||
## Changes
|
|
||||||
|
|
||||||
```diff
|
|
||||||
diff --git schema.prisma schema.prisma
|
|
||||||
migration 20201107124332-init..20201110184959-init
|
|
||||||
--- datamodel.dml
|
|
||||||
+++ datamodel.dml
|
|
||||||
@@ -3,9 +3,9 @@
|
|
||||||
}
|
|
||||||
datasource db {
|
|
||||||
provider = "postgresql"
|
|
||||||
- url = "***"
|
|
||||||
+ url = "***"
|
|
||||||
}
|
|
||||||
model ResetToken {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
@@ -84,10 +84,10 @@
|
|
||||||
apName String?
|
|
||||||
status Status?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
- userId Int
|
|
||||||
- user User @relation(fields: [userId], references: [id], name: "wifidevice_to_user")
|
|
||||||
+ userId Int?
|
|
||||||
+ user User? @relation(fields: [userId], references: [id], name: "wifidevice_to_user")
|
|
||||||
}
|
|
||||||
enum Status {
|
|
||||||
ONLINE
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
generator client {
|
|
||||||
provider = "prisma-client-js"
|
|
||||||
}
|
|
||||||
|
|
||||||
datasource db {
|
|
||||||
provider = "postgresql"
|
|
||||||
url = "***"
|
|
||||||
}
|
|
||||||
|
|
||||||
model ResetToken {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
token String @unique
|
|
||||||
expiration DateTime
|
|
||||||
usedAt DateTime?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
user User @relation(fields: [userId], references: [id], name: "resettoken_to_user")
|
|
||||||
userId Int
|
|
||||||
creator User @relation(fields: [creatorId], references: [id], name: "resettoken_to_creator")
|
|
||||||
creatorId Int
|
|
||||||
}
|
|
||||||
|
|
||||||
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 String?
|
|
||||||
sAMAccountName String @unique
|
|
||||||
sAMAccountType String?
|
|
||||||
sn String?
|
|
||||||
thumbnailPhoto String?
|
|
||||||
title String?
|
|
||||||
userAccountControl String?
|
|
||||||
userPrincipalName String?
|
|
||||||
whenChanged String?
|
|
||||||
whenCreated String?
|
|
||||||
createdTokens ResetToken[] @relation("resettoken_to_user")
|
|
||||||
tokens ResetToken[] @relation("resettoken_to_creator")
|
|
||||||
WifiDevice WifiDevice[] @relation("wifidevice_to_user")
|
|
||||||
}
|
|
||||||
|
|
||||||
model WifiDevice {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
oui String?
|
|
||||||
mac String @unique
|
|
||||||
hostname String?
|
|
||||||
firstSeen String?
|
|
||||||
lastSeen String?
|
|
||||||
essid String?
|
|
||||||
ip String?
|
|
||||||
uptime String?
|
|
||||||
apName String?
|
|
||||||
status Status?
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
userId Int?
|
|
||||||
user User? @relation(fields: [userId], references: [id], name: "wifidevice_to_user")
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Status {
|
|
||||||
ONLINE
|
|
||||||
OFFLINE
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.3.14-fixed",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"tag": "UpdateField",
|
|
||||||
"model": "WifiDevice",
|
|
||||||
"field": "userId",
|
|
||||||
"arity": "Optional"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tag": "UpdateField",
|
|
||||||
"model": "WifiDevice",
|
|
||||||
"field": "user",
|
|
||||||
"arity": "Optional"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Migration `20201106194210-init`
|
# Migration `20201110194349-init`
|
||||||
|
|
||||||
This migration has been generated by Douglas Barone at 11/6/2020, 3:42:10 PM.
|
This migration has been generated by Douglas Barone at 11/10/2020, 3:43:49 PM.
|
||||||
You can check out the [state of the schema](./schema.prisma) after the migration.
|
You can check out the [state of the schema](./schema.prisma) after the migration.
|
||||||
|
|
||||||
## Database Steps
|
## Database Steps
|
||||||
|
@ -54,7 +54,7 @@ CREATE TABLE "public"."User" (
|
||||||
"objectGUID" text ,
|
"objectGUID" text ,
|
||||||
"objectSid" text ,
|
"objectSid" text ,
|
||||||
"primaryGroupID" text ,
|
"primaryGroupID" text ,
|
||||||
"pwdLastSet" text ,
|
"pwdLastSet" timestamp(3) ,
|
||||||
"sAMAccountName" text NOT NULL ,
|
"sAMAccountName" text NOT NULL ,
|
||||||
"sAMAccountType" text ,
|
"sAMAccountType" text ,
|
||||||
"sn" text ,
|
"sn" text ,
|
||||||
|
@ -70,10 +70,10 @@ PRIMARY KEY ("id")
|
||||||
CREATE TABLE "public"."WifiDevice" (
|
CREATE TABLE "public"."WifiDevice" (
|
||||||
"id" SERIAL,
|
"id" SERIAL,
|
||||||
"oui" text ,
|
"oui" text ,
|
||||||
"mac" text ,
|
"mac" text NOT NULL ,
|
||||||
"hostname" text ,
|
"hostname" text ,
|
||||||
"firstSeen" text ,
|
"firstSeen" timestamp(3) ,
|
||||||
"lastSeen" text ,
|
"lastSeen" timestamp(3) ,
|
||||||
"essid" text ,
|
"essid" text ,
|
||||||
"ip" text ,
|
"ip" text ,
|
||||||
"uptime" text ,
|
"uptime" text ,
|
||||||
|
@ -81,7 +81,7 @@ CREATE TABLE "public"."WifiDevice" (
|
||||||
"status" "Status" ,
|
"status" "Status" ,
|
||||||
"createdAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"createdAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"updatedAt" timestamp(3) NOT NULL ,
|
"updatedAt" timestamp(3) NOT NULL ,
|
||||||
"userId" integer NOT NULL ,
|
"userId" integer ,
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -95,14 +95,14 @@ ALTER TABLE "public"."ResetToken" ADD FOREIGN KEY("userId")REFERENCES "public"."
|
||||||
|
|
||||||
ALTER TABLE "public"."ResetToken" ADD FOREIGN KEY("creatorId")REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE
|
ALTER TABLE "public"."ResetToken" ADD FOREIGN KEY("creatorId")REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
|
||||||
ALTER TABLE "public"."WifiDevice" ADD FOREIGN KEY("userId")REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE
|
ALTER TABLE "public"."WifiDevice" ADD FOREIGN KEY("userId")REFERENCES "public"."User"("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||||
```
|
```
|
||||||
|
|
||||||
## Changes
|
## Changes
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
diff --git schema.prisma schema.prisma
|
diff --git schema.prisma schema.prisma
|
||||||
migration ..20201106194210-init
|
migration ..20201110194349-init
|
||||||
--- datamodel.dml
|
--- datamodel.dml
|
||||||
+++ datamodel.dml
|
+++ datamodel.dml
|
||||||
@@ -1,0 +1,95 @@
|
@@ -1,0 +1,95 @@
|
||||||
|
@ -164,7 +164,7 @@ migration ..20201106194210-init
|
||||||
+ objectGUID String?
|
+ objectGUID String?
|
||||||
+ objectSid String?
|
+ objectSid String?
|
||||||
+ primaryGroupID String?
|
+ primaryGroupID String?
|
||||||
+ pwdLastSet String?
|
+ pwdLastSet DateTime?
|
||||||
+ sAMAccountName String @unique
|
+ sAMAccountName String @unique
|
||||||
+ sAMAccountType String?
|
+ sAMAccountType String?
|
||||||
+ sn String?
|
+ sn String?
|
||||||
|
@ -176,16 +176,16 @@ migration ..20201106194210-init
|
||||||
+ whenCreated String?
|
+ whenCreated String?
|
||||||
+ createdTokens ResetToken[] @relation("resettoken_to_user")
|
+ createdTokens ResetToken[] @relation("resettoken_to_user")
|
||||||
+ tokens ResetToken[] @relation("resettoken_to_creator")
|
+ tokens ResetToken[] @relation("resettoken_to_creator")
|
||||||
+ WifiDevice WifiDevice[]
|
+ WifiDevice WifiDevice[] @relation("wifidevice_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 String?
|
+ firstSeen DateTime?
|
||||||
+ lastSeen String?
|
+ lastSeen DateTime?
|
||||||
+ essid String?
|
+ essid String?
|
||||||
+ ip String?
|
+ ip String?
|
||||||
+ uptime String?
|
+ uptime String?
|
||||||
|
@ -193,8 +193,8 @@ migration ..20201106194210-init
|
||||||
+ status Status?
|
+ status Status?
|
||||||
+ createdAt DateTime @default(now())
|
+ createdAt DateTime @default(now())
|
||||||
+ updatedAt DateTime @updatedAt
|
+ updatedAt DateTime @updatedAt
|
||||||
+ userId Int
|
+ userId Int?
|
||||||
+ user User @relation(fields: [userId], references: [id])
|
+ user User? @relation(fields: [userId], references: [id], name: "wifidevice_to_user")
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+enum Status {
|
+enum Status {
|
|
@ -56,7 +56,7 @@ model User {
|
||||||
objectGUID String?
|
objectGUID String?
|
||||||
objectSid String?
|
objectSid String?
|
||||||
primaryGroupID String?
|
primaryGroupID String?
|
||||||
pwdLastSet String?
|
pwdLastSet DateTime?
|
||||||
sAMAccountName String @unique
|
sAMAccountName String @unique
|
||||||
sAMAccountType String?
|
sAMAccountType String?
|
||||||
sn String?
|
sn String?
|
||||||
|
@ -76,8 +76,8 @@ model WifiDevice {
|
||||||
oui String?
|
oui String?
|
||||||
mac String @unique
|
mac String @unique
|
||||||
hostname String?
|
hostname String?
|
||||||
firstSeen String?
|
firstSeen DateTime?
|
||||||
lastSeen String?
|
lastSeen DateTime?
|
||||||
essid String?
|
essid String?
|
||||||
ip String?
|
ip String?
|
||||||
uptime String?
|
uptime String?
|
||||||
|
@ -85,8 +85,8 @@ model WifiDevice {
|
||||||
status Status?
|
status Status?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
userId Int
|
userId Int?
|
||||||
user User @relation(fields: [userId], references: [id], name: "wifidevice_to_user")
|
user User? @relation(fields: [userId], references: [id], name: "wifidevice_to_user")
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Status {
|
enum Status {
|
|
@ -619,7 +619,7 @@
|
||||||
"tag": "CreateField",
|
"tag": "CreateField",
|
||||||
"model": "User",
|
"model": "User",
|
||||||
"field": "pwdLastSet",
|
"field": "pwdLastSet",
|
||||||
"type": "String",
|
"type": "DateTime",
|
||||||
"arity": "Optional"
|
"arity": "Optional"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -767,6 +767,31 @@
|
||||||
"type": "WifiDevice",
|
"type": "WifiDevice",
|
||||||
"arity": "List"
|
"arity": "List"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"tag": "CreateDirective",
|
||||||
|
"location": {
|
||||||
|
"path": {
|
||||||
|
"tag": "Field",
|
||||||
|
"model": "User",
|
||||||
|
"field": "WifiDevice"
|
||||||
|
},
|
||||||
|
"directive": "relation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "CreateArgument",
|
||||||
|
"location": {
|
||||||
|
"tag": "Directive",
|
||||||
|
"path": {
|
||||||
|
"tag": "Field",
|
||||||
|
"model": "User",
|
||||||
|
"field": "WifiDevice"
|
||||||
|
},
|
||||||
|
"directive": "relation"
|
||||||
|
},
|
||||||
|
"argument": "",
|
||||||
|
"value": "\"wifidevice_to_user\""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"tag": "CreateModel",
|
"tag": "CreateModel",
|
||||||
"model": "WifiDevice"
|
"model": "WifiDevice"
|
||||||
|
@ -826,7 +851,7 @@
|
||||||
"model": "WifiDevice",
|
"model": "WifiDevice",
|
||||||
"field": "mac",
|
"field": "mac",
|
||||||
"type": "String",
|
"type": "String",
|
||||||
"arity": "Optional"
|
"arity": "Required"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "CreateDirective",
|
"tag": "CreateDirective",
|
||||||
|
@ -850,14 +875,14 @@
|
||||||
"tag": "CreateField",
|
"tag": "CreateField",
|
||||||
"model": "WifiDevice",
|
"model": "WifiDevice",
|
||||||
"field": "firstSeen",
|
"field": "firstSeen",
|
||||||
"type": "String",
|
"type": "DateTime",
|
||||||
"arity": "Optional"
|
"arity": "Optional"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "CreateField",
|
"tag": "CreateField",
|
||||||
"model": "WifiDevice",
|
"model": "WifiDevice",
|
||||||
"field": "lastSeen",
|
"field": "lastSeen",
|
||||||
"type": "String",
|
"type": "DateTime",
|
||||||
"arity": "Optional"
|
"arity": "Optional"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -950,14 +975,14 @@
|
||||||
"model": "WifiDevice",
|
"model": "WifiDevice",
|
||||||
"field": "userId",
|
"field": "userId",
|
||||||
"type": "Int",
|
"type": "Int",
|
||||||
"arity": "Required"
|
"arity": "Optional"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "CreateField",
|
"tag": "CreateField",
|
||||||
"model": "WifiDevice",
|
"model": "WifiDevice",
|
||||||
"field": "user",
|
"field": "user",
|
||||||
"type": "User",
|
"type": "User",
|
||||||
"arity": "Required"
|
"arity": "Optional"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "CreateDirective",
|
"tag": "CreateDirective",
|
||||||
|
@ -997,6 +1022,20 @@
|
||||||
},
|
},
|
||||||
"argument": "references",
|
"argument": "references",
|
||||||
"value": "[id]"
|
"value": "[id]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "CreateArgument",
|
||||||
|
"location": {
|
||||||
|
"tag": "Directive",
|
||||||
|
"path": {
|
||||||
|
"tag": "Field",
|
||||||
|
"model": "WifiDevice",
|
||||||
|
"field": "user"
|
||||||
|
},
|
||||||
|
"directive": "relation"
|
||||||
|
},
|
||||||
|
"argument": "name",
|
||||||
|
"value": "\"wifidevice_to_user\""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,6 +1,3 @@
|
||||||
# Prisma Migrate lockfile v1
|
# Prisma Migrate lockfile v1
|
||||||
|
|
||||||
20201106194210-init
|
20201110194349-init
|
||||||
20201107123940-init
|
|
||||||
20201107124332-init
|
|
||||||
20201110184959-init
|
|
|
@ -56,7 +56,7 @@ model User {
|
||||||
objectGUID String?
|
objectGUID String?
|
||||||
objectSid String?
|
objectSid String?
|
||||||
primaryGroupID String?
|
primaryGroupID String?
|
||||||
pwdLastSet String?
|
pwdLastSet DateTime?
|
||||||
sAMAccountName String @unique
|
sAMAccountName String @unique
|
||||||
sAMAccountType String?
|
sAMAccountType String?
|
||||||
sn String?
|
sn String?
|
||||||
|
@ -76,8 +76,8 @@ model WifiDevice {
|
||||||
oui String?
|
oui String?
|
||||||
mac String @unique
|
mac String @unique
|
||||||
hostname String?
|
hostname String?
|
||||||
firstSeen String?
|
firstSeen DateTime?
|
||||||
lastSeen String?
|
lastSeen DateTime?
|
||||||
essid String?
|
essid String?
|
||||||
ip String?
|
ip String?
|
||||||
uptime String?
|
uptime String?
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { updateDBWithOnlineDevices } from '../utils/wifiUtils'
|
import { updateDBWithOnlineDevices } from '../utils/wifiUtils'
|
||||||
import { User } from '../classes/User'
|
import { User } from '../classes/User'
|
||||||
import { gql } from 'apollo-server'
|
|
||||||
import prisma from '../prisma'
|
import prisma from '../prisma'
|
||||||
|
|
||||||
const parseSAMAccountName = sAMAccountName =>
|
const parseSAMAccountName = sAMAccountName =>
|
||||||
|
@ -99,10 +99,11 @@ const Query = {
|
||||||
// })
|
// })
|
||||||
|
|
||||||
return prisma.wifiDevices({
|
return prisma.wifiDevices({
|
||||||
orderBy: 'lastSeen_DESC',
|
orderBy: [{ lastSeen: 'desc' }],
|
||||||
where: identifiedOnly ? { NOT: { user: null } } : {}
|
where: identifiedOnly ? { NOT: { user: null } } : {}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
userPresence: async (_, { search }) => {
|
userPresence: async (_, { search }) => {
|
||||||
if (!search) {
|
if (!search) {
|
||||||
await updateDBWithOnlineDevices()
|
await updateDBWithOnlineDevices()
|
||||||
|
@ -113,7 +114,7 @@ const Query = {
|
||||||
where: {
|
where: {
|
||||||
WifiDevice: { some: { lastSeen: { not: null } } }
|
WifiDevice: { some: { lastSeen: { not: null } } }
|
||||||
},
|
},
|
||||||
include: { WifiDevice: true }
|
include: { WifiDevice: { orderBy: [{ lastSeen: 'desc' }] } }
|
||||||
})
|
})
|
||||||
|
|
||||||
const userPresences = usersWithWifiDevices
|
const userPresences = usersWithWifiDevices
|
||||||
|
@ -126,9 +127,7 @@ const Query = {
|
||||||
displayName: user.displayName,
|
displayName: user.displayName,
|
||||||
thumbnailPhoto: user.thumbnailPhoto
|
thumbnailPhoto: user.thumbnailPhoto
|
||||||
},
|
},
|
||||||
wifiDevices: user.WifiDevice.sort((a, b) =>
|
wifiDevices: user.WifiDevice
|
||||||
a.lastSeen > b.lastSeen ? -1 : 1
|
|
||||||
)
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const sortedUserPresences = userPresences.sort((a, b) =>
|
const sortedUserPresences = userPresences.sort((a, b) =>
|
||||||
|
|
|
@ -9,6 +9,7 @@ const User = {
|
||||||
|
|
||||||
lastLogin: _ => _.lastLogin.toISOString(),
|
lastLogin: _ => _.lastLogin.toISOString(),
|
||||||
lastLoginPrior: _ => _.lastLoginPrior.toISOString(),
|
lastLoginPrior: _ => _.lastLoginPrior.toISOString(),
|
||||||
|
pwdLastSet: _ => _.pwdLastSet.toISOString(),
|
||||||
|
|
||||||
sharedFolders: _ =>
|
sharedFolders: _ =>
|
||||||
_.groups
|
_.groups
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import prisma from '../prisma'
|
import prisma from '../prisma'
|
||||||
|
|
||||||
const WifiDevice = {
|
const WifiDevice = {
|
||||||
user: _ => prisma.wifiDevice.findOne({ where: { id: _.id } }).User()
|
user: _ => prisma.wifiDevice.findOne({ where: { id: _.id } }).User(),
|
||||||
|
lastSeen: _ => _.lastSeen.toISOString(),
|
||||||
|
firstSeen: _ => _.firstSeen.toISOString()
|
||||||
}
|
}
|
||||||
|
|
||||||
export { WifiDevice }
|
export { WifiDevice }
|
||||||
|
|
|
@ -28,7 +28,7 @@ class AuthDirective extends SchemaDirectiveVisitor {
|
||||||
|
|
||||||
context.auth = user
|
context.auth = user
|
||||||
|
|
||||||
if (user.pwdLastSet === pwdLastSet) {
|
if (user.pwdLastSet.toISOString() === pwdLastSet) {
|
||||||
if (
|
if (
|
||||||
expectedRoles.length === 0 ||
|
expectedRoles.length === 0 ||
|
||||||
expectedRoles.some(role => user.roles.includes(role))
|
expectedRoles.some(role => user.roles.includes(role))
|
||||||
|
|
|
@ -18,8 +18,8 @@ const getOnlineWifiDevices = async () => {
|
||||||
oui: client.oui,
|
oui: client.oui,
|
||||||
mac: client.mac,
|
mac: client.mac,
|
||||||
hostname: client.hostname,
|
hostname: client.hostname,
|
||||||
firstSeen: new Date(client.first_seen * 1000).toISOString(),
|
firstSeen: new Date(client.first_seen * 1000),
|
||||||
lastSeen: new Date(client.last_seen * 1000).toISOString(),
|
lastSeen: new Date(client.last_seen * 1000),
|
||||||
essid: client.essid,
|
essid: client.essid,
|
||||||
ip: client.ip,
|
ip: client.ip,
|
||||||
uptime: client.uptime.toString(),
|
uptime: client.uptime.toString(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user