confirm actions
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "AuthSession" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"userId" TEXT NOT NULL,
|
||||
"expiresAt" DATETIME NOT NULL,
|
||||
"lastSeenAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"ipAddress" TEXT,
|
||||
"userAgent" TEXT,
|
||||
"revokedAt" DATETIME,
|
||||
"revokedById" TEXT,
|
||||
"revokedReason" TEXT,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
CONSTRAINT "AuthSession_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT "AuthSession_revokedById_fkey" FOREIGN KEY ("revokedById") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "AuthSession_userId_createdAt_idx" ON "AuthSession"("userId", "createdAt");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "AuthSession_expiresAt_idx" ON "AuthSession"("expiresAt");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "AuthSession_revokedAt_idx" ON "AuthSession"("revokedAt");
|
||||
@@ -18,6 +18,8 @@ model User {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
userRoles UserRole[]
|
||||
authSessions AuthSession[] @relation("AuthSessionUser")
|
||||
revokedAuthSessions AuthSession[] @relation("AuthSessionRevokedBy")
|
||||
contactEntries CrmContactEntry[]
|
||||
inventoryTransactions InventoryTransaction[]
|
||||
purchaseReceipts PurchaseReceipt[]
|
||||
@@ -72,6 +74,26 @@ model RolePermission {
|
||||
@@id([roleId, permissionId])
|
||||
}
|
||||
|
||||
model AuthSession {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
expiresAt DateTime
|
||||
lastSeenAt DateTime @default(now())
|
||||
ipAddress String?
|
||||
userAgent String?
|
||||
revokedAt DateTime?
|
||||
revokedById String?
|
||||
revokedReason String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
user User @relation("AuthSessionUser", fields: [userId], references: [id], onDelete: Cascade)
|
||||
revokedBy User? @relation("AuthSessionRevokedBy", fields: [revokedById], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([userId, createdAt])
|
||||
@@index([expiresAt])
|
||||
@@index([revokedAt])
|
||||
}
|
||||
|
||||
model CompanyProfile {
|
||||
id String @id @default(cuid())
|
||||
companyName String
|
||||
|
||||
Reference in New Issue
Block a user