Add repair notes journal with running feed, visibility, and status tagging
New repair_note table for timestamped journal entries on tickets. Each note captures author, content, visibility (internal or customer-facing), and the ticket status at time of writing. Notes display as a running feed on the ticket detail page with newest first. Internal notes have a lock icon, customer-visible notes highlighted in blue. Supports add and delete with appropriate permission gating.
This commit is contained in:
@@ -140,6 +140,26 @@ export const repairLineItems = pgTable('repair_line_item', {
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
})
|
||||
|
||||
export const repairNoteVisibilityEnum = pgEnum('repair_note_visibility', ['internal', 'customer'])
|
||||
|
||||
export const repairNotes = pgTable('repair_note', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
repairTicketId: uuid('repair_ticket_id')
|
||||
.notNull()
|
||||
.references(() => repairTickets.id),
|
||||
authorId: uuid('author_id')
|
||||
.notNull()
|
||||
.references(() => users.id),
|
||||
authorName: varchar('author_name', { length: 255 }).notNull(),
|
||||
content: text('content').notNull(),
|
||||
visibility: repairNoteVisibilityEnum('visibility').notNull().default('internal'),
|
||||
ticketStatus: repairTicketStatusEnum('ticket_status'),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
})
|
||||
|
||||
export type RepairNote = typeof repairNotes.$inferSelect
|
||||
export type RepairNoteInsert = typeof repairNotes.$inferInsert
|
||||
|
||||
export const repairServiceTemplates = pgTable('repair_service_template', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
companyId: uuid('company_id')
|
||||
|
||||
Reference in New Issue
Block a user