Files
TicketingSystem/server/prisma/schema.prisma
josh 725f91578d
All checks were successful
Build & Push / Build Server (push) Successful in 2m5s
Build & Push / Build Client (push) Successful in 41s
Dark theme, roles overhaul, modal New Ticket, My Tickets page, and more
- Dark UI across all pages and components (gray-950/900/800 palette)
- New Ticket is now a centered modal (triggered from sidebar), not a separate page
- Add USER role: view and comment only; AGENT and SERVICE can create/edit tickets
- Only admins can set ticket status to CLOSED (enforced server + UI)
- Add My Tickets page (/my-tickets) showing tickets assigned to current user
- Add queue (category) filter to Dashboard
- Audit log entries are clickable to expand detail; comment body shown as markdown
- Resolved date now includes time (HH:mm) in ticket sidebar
- Store comment body in audit log detail for COMMENT_ADDED and COMMENT_DELETED
- Clarify role descriptions in Admin Users modal
- Remove CI/CD section from README; add full API reference documentation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 23:17:14 -04:00

117 lines
2.8 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum Role {
ADMIN
AGENT
USER
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 @default(dbgenerated("concat('V', (floor(random() * 900000000) + 100000000)::bigint::text)"))
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])
}