feat: migrate auth stack and admin portal
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
parent
ff674d5bb5
commit
7946b8d017
46 changed files with 2564 additions and 178 deletions
|
|
@ -3,7 +3,7 @@ generator client {
|
|||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
provider = "sqlite"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ model Queue {
|
|||
model Ticket {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
reference Int @default(autoincrement())
|
||||
reference Int @default(0)
|
||||
subject String
|
||||
summary String?
|
||||
status TicketStatus @default(NEW)
|
||||
|
|
@ -126,6 +126,7 @@ model Ticket {
|
|||
requester User @relation("TicketRequester", fields: [requesterId], references: [id])
|
||||
assignee User? @relation("TicketAssignee", fields: [assigneeId], references: [id])
|
||||
queue Queue? @relation(fields: [queueId], references: [id])
|
||||
slaPolicy SlaPolicy? @relation(fields: [slaPolicyId], references: [id])
|
||||
events TicketEvent[]
|
||||
comments TicketComment[]
|
||||
|
||||
|
|
@ -177,3 +178,66 @@ model SlaPolicy {
|
|||
|
||||
@@unique([tenantId, name])
|
||||
}
|
||||
|
||||
model AuthUser {
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String @unique
|
||||
emailVerified Boolean @default(false)
|
||||
image String?
|
||||
role String @default("agent")
|
||||
tenantId String?
|
||||
avatarUrl String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
sessions AuthSession[]
|
||||
accounts AuthAccount[]
|
||||
}
|
||||
|
||||
model AuthSession {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
token String @unique
|
||||
expiresAt DateTime
|
||||
ipAddress String?
|
||||
userAgent String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([userId])
|
||||
@@index([token])
|
||||
}
|
||||
|
||||
model AuthAccount {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
accountId String
|
||||
providerId String
|
||||
accessToken String?
|
||||
refreshToken String?
|
||||
accessTokenExpiresAt DateTime?
|
||||
refreshTokenExpiresAt DateTime?
|
||||
scope String?
|
||||
idToken String?
|
||||
password String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([providerId, accountId])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model AuthVerification {
|
||||
id String @id @default(cuid())
|
||||
identifier String
|
||||
value String
|
||||
expiresAt DateTime
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([identifier])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue