- Tickets get a random display ID (V + 9 digits, e.g. V325813929) - Ticket detail page has Overview / Comments / Audit Log tabs - Audit log records every action (create, status, assignee, severity, reroute, title/overview edit, comment add/delete) with who and when - Comments redesigned: avatar (initials + color), markdown rendering via react-markdown + remark-gfm, Write/Preview toggle - Dashboard shows displayId and assignee avatar - URLs now use displayId (/tickets/V325813929) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
116 lines
2.7 KiB
Plaintext
116 lines
2.7 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum Role {
|
|
ADMIN
|
|
AGENT
|
|
SERVICE
|
|
}
|
|
|
|
enum TicketStatus {
|
|
OPEN
|
|
IN_PROGRESS
|
|
RESOLVED
|
|
CLOSED
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
username String @unique
|
|
email String @unique
|
|
passwordHash String
|
|
displayName String
|
|
role Role @default(AGENT)
|
|
apiKey String? @unique
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
assignedTickets Ticket[] @relation("AssignedTickets")
|
|
createdTickets Ticket[] @relation("CreatedTickets")
|
|
comments Comment[]
|
|
auditLogs AuditLog[]
|
|
}
|
|
|
|
model Category {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
types Type[]
|
|
tickets Ticket[]
|
|
}
|
|
|
|
model Type {
|
|
id String @id @default(cuid())
|
|
name String
|
|
categoryId String
|
|
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
|
|
items Item[]
|
|
tickets Ticket[]
|
|
|
|
@@unique([categoryId, name])
|
|
}
|
|
|
|
model Item {
|
|
id String @id @default(cuid())
|
|
name String
|
|
typeId String
|
|
type Type @relation(fields: [typeId], references: [id], onDelete: Cascade)
|
|
tickets Ticket[]
|
|
|
|
@@unique([typeId, name])
|
|
}
|
|
|
|
model Ticket {
|
|
id String @id @default(cuid())
|
|
displayId String @unique
|
|
title String
|
|
overview String
|
|
severity Int
|
|
status TicketStatus @default(OPEN)
|
|
categoryId String
|
|
typeId String
|
|
itemId String
|
|
assigneeId String?
|
|
createdById String
|
|
|
|
resolvedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
category Category @relation(fields: [categoryId], references: [id])
|
|
type Type @relation(fields: [typeId], references: [id])
|
|
item Item @relation(fields: [itemId], references: [id])
|
|
assignee User? @relation("AssignedTickets", fields: [assigneeId], references: [id])
|
|
createdBy User @relation("CreatedTickets", fields: [createdById], references: [id])
|
|
comments Comment[]
|
|
auditLogs AuditLog[]
|
|
}
|
|
|
|
model Comment {
|
|
id String @id @default(cuid())
|
|
body String
|
|
ticketId String
|
|
authorId String
|
|
createdAt DateTime @default(now())
|
|
|
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
|
author User @relation(fields: [authorId], references: [id])
|
|
}
|
|
|
|
model AuditLog {
|
|
id String @id @default(cuid())
|
|
ticketId String
|
|
userId String
|
|
action String
|
|
detail String?
|
|
createdAt DateTime @default(now())
|
|
|
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
|
user User @relation(fields: [userId], references: [id])
|
|
}
|