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:
@@ -1,6 +1,6 @@
|
||||
import { queryOptions } from '@tanstack/react-query'
|
||||
import { api } from '@/lib/api-client'
|
||||
import type { RepairTicket, RepairLineItem, RepairBatch, RepairServiceTemplate } from '@/types/repair'
|
||||
import type { RepairTicket, RepairLineItem, RepairBatch, RepairNote, RepairServiceTemplate } from '@/types/repair'
|
||||
import type { PaginatedResponse, PaginationInput } from '@forte/shared/schemas'
|
||||
|
||||
// --- Repair Tickets ---
|
||||
@@ -89,6 +89,27 @@ export function repairBatchTicketsOptions(batchId: string, params: PaginationInp
|
||||
})
|
||||
}
|
||||
|
||||
// --- Repair Notes ---
|
||||
|
||||
export const repairNoteKeys = {
|
||||
all: (ticketId: string) => ['repair-tickets', ticketId, 'notes'] as const,
|
||||
}
|
||||
|
||||
export function repairNoteListOptions(ticketId: string) {
|
||||
return queryOptions({
|
||||
queryKey: repairNoteKeys.all(ticketId),
|
||||
queryFn: () => api.get<{ data: RepairNote[] }>(`/v1/repair-tickets/${ticketId}/notes`),
|
||||
enabled: !!ticketId,
|
||||
})
|
||||
}
|
||||
|
||||
export const repairNoteMutations = {
|
||||
create: (ticketId: string, data: Record<string, unknown>) =>
|
||||
api.post<RepairNote>(`/v1/repair-tickets/${ticketId}/notes`, data),
|
||||
delete: (id: string) =>
|
||||
api.del<RepairNote>(`/v1/repair-notes/${id}`),
|
||||
}
|
||||
|
||||
// --- Repair Service Templates ---
|
||||
|
||||
export const repairServiceTemplateKeys = {
|
||||
|
||||
Reference in New Issue
Block a user