mirror of
https://github.com/mosh-hamedani/helpdesk.git
synced 2026-05-21 11:58:19 +02:00
130 lines
2.9 KiB
Text
130 lines
2.9 KiB
Text
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
|
|
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
enum Role {
|
|
admin
|
|
agent
|
|
}
|
|
|
|
enum TicketStatus {
|
|
open
|
|
resolved
|
|
closed
|
|
}
|
|
|
|
enum SenderType {
|
|
agent
|
|
customer
|
|
}
|
|
|
|
enum TicketCategory {
|
|
general_question
|
|
technical_question
|
|
refund_request
|
|
}
|
|
|
|
model User {
|
|
id String @id
|
|
name String
|
|
email String @unique
|
|
emailVerified Boolean
|
|
image String?
|
|
role Role @default(agent)
|
|
createdAt DateTime
|
|
updatedAt DateTime
|
|
deletedAt DateTime?
|
|
sessions Session[]
|
|
accounts Account[]
|
|
assignedTickets Ticket[]
|
|
replies Reply[]
|
|
|
|
@@map("user")
|
|
}
|
|
|
|
model Session {
|
|
id String @id
|
|
expiresAt DateTime
|
|
token String @unique
|
|
createdAt DateTime
|
|
updatedAt DateTime
|
|
ipAddress String?
|
|
userAgent String?
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@map("session")
|
|
}
|
|
|
|
model Account {
|
|
id String @id
|
|
accountId String
|
|
providerId String
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
accessToken String?
|
|
refreshToken String?
|
|
idToken String?
|
|
accessTokenExpiresAt DateTime?
|
|
refreshTokenExpiresAt DateTime?
|
|
scope String?
|
|
password String?
|
|
createdAt DateTime
|
|
updatedAt DateTime
|
|
|
|
@@map("account")
|
|
}
|
|
|
|
model Ticket {
|
|
id Int @id @default(autoincrement())
|
|
subject String
|
|
body String
|
|
bodyHtml String?
|
|
status TicketStatus @default(open)
|
|
category TicketCategory?
|
|
senderName String
|
|
senderEmail String
|
|
assignedToId String?
|
|
assignedTo User? @relation(fields: [assignedToId], references: [id])
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
replies Reply[]
|
|
|
|
@@map("ticket")
|
|
}
|
|
|
|
model Reply {
|
|
id Int @id @default(autoincrement())
|
|
body String
|
|
senderType SenderType
|
|
ticketId Int
|
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
|
userId String?
|
|
user User? @relation(fields: [userId], references: [id])
|
|
createdAt DateTime @default(now())
|
|
|
|
@@map("reply")
|
|
}
|
|
|
|
model Verification {
|
|
id String @id
|
|
identifier String
|
|
value String
|
|
expiresAt DateTime
|
|
createdAt DateTime?
|
|
updatedAt DateTime?
|
|
|
|
@@map("verification")
|
|
}
|