@varaos/db 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/prisma/schema.prisma +60 -0
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -369,6 +369,12 @@ model User {
|
|
|
369
369
|
|
|
370
370
|
toolRequests ToolRequest[]
|
|
371
371
|
|
|
372
|
+
/// Admin panel relations
|
|
373
|
+
adminSessions AdminSession[]
|
|
374
|
+
adminOTPs AdminOTP[]
|
|
375
|
+
impersonationsAsActor ImpersonationSession[] @relation("ImpersonationActor")
|
|
376
|
+
impersonationsAsTarget ImpersonationSession[] @relation("ImpersonationTarget")
|
|
377
|
+
|
|
372
378
|
@@index([status])
|
|
373
379
|
}
|
|
374
380
|
|
|
@@ -2049,3 +2055,57 @@ model DeadLetterJob {
|
|
|
2049
2055
|
@@index([reviewed])
|
|
2050
2056
|
@@index([createdAt])
|
|
2051
2057
|
}
|
|
2058
|
+
|
|
2059
|
+
|
|
2060
|
+
/// ─────────────────────────────────────────────────────────────
|
|
2061
|
+
/// ADMIN USER MANAGEMENT (For SaaS Admin Panel)
|
|
2062
|
+
/// ─────────────────────────────────────────────────────────────
|
|
2063
|
+
|
|
2064
|
+
model AdminSession {
|
|
2065
|
+
id String @id @default(uuid())
|
|
2066
|
+
userId String
|
|
2067
|
+
token String @unique
|
|
2068
|
+
role Role
|
|
2069
|
+
ip String?
|
|
2070
|
+
userAgent String?
|
|
2071
|
+
expiresAt DateTime
|
|
2072
|
+
revokedAt DateTime?
|
|
2073
|
+
createdAt DateTime @default(now())
|
|
2074
|
+
|
|
2075
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
2076
|
+
|
|
2077
|
+
@@index([userId])
|
|
2078
|
+
@@index([token])
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
model AdminOTP {
|
|
2082
|
+
id String @id @default(uuid())
|
|
2083
|
+
userId String
|
|
2084
|
+
code String
|
|
2085
|
+
used Boolean @default(false)
|
|
2086
|
+
expiresAt DateTime
|
|
2087
|
+
createdAt DateTime @default(now())
|
|
2088
|
+
|
|
2089
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
2090
|
+
|
|
2091
|
+
@@index([userId, used])
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
model ImpersonationSession {
|
|
2095
|
+
id String @id @default(uuid())
|
|
2096
|
+
actorId String
|
|
2097
|
+
targetId String
|
|
2098
|
+
token String @unique
|
|
2099
|
+
reason String
|
|
2100
|
+
used Boolean @default(false)
|
|
2101
|
+
usedAt DateTime?
|
|
2102
|
+
expiresAt DateTime
|
|
2103
|
+
revokedAt DateTime?
|
|
2104
|
+
createdAt DateTime @default(now())
|
|
2105
|
+
|
|
2106
|
+
actor User @relation("ImpersonationActor", fields: [actorId], references: [id])
|
|
2107
|
+
target User @relation("ImpersonationTarget", fields: [targetId], references: [id])
|
|
2108
|
+
|
|
2109
|
+
@@index([actorId])
|
|
2110
|
+
@@index([targetId])
|
|
2111
|
+
}
|