feat: add SLA category breakdown report
This commit is contained in:
parent
6ab8a6ce89
commit
a62f3d5283
8 changed files with 231 additions and 10 deletions
|
|
@ -6,6 +6,7 @@ type ReportsCtxOptions = {
|
|||
tickets?: Doc<"tickets">[]
|
||||
createdRangeTickets?: Doc<"tickets">[]
|
||||
queues?: Doc<"queues">[]
|
||||
categories?: Doc<"ticketCategories">[]
|
||||
companies?: Map<string, Doc<"companies">>
|
||||
users?: Map<string, Doc<"users">>
|
||||
ticketEventsByTicket?: Map<string, Array<{ type: string; payload?: unknown; createdAt: number }>>
|
||||
|
|
@ -38,6 +39,7 @@ export function createReportsCtx({
|
|||
tickets = [],
|
||||
createdRangeTickets = tickets,
|
||||
queues = [],
|
||||
categories = [],
|
||||
companies = new Map<string, Doc<"companies">>(),
|
||||
users = new Map<string, Doc<"users">>(),
|
||||
ticketEventsByTicket = new Map<string, Array<{ type: string; payload?: unknown; createdAt: number }>>(),
|
||||
|
|
@ -78,6 +80,18 @@ export function createReportsCtx({
|
|||
}
|
||||
}
|
||||
|
||||
if (table === "ticketCategories") {
|
||||
return {
|
||||
withIndex: vi.fn((_indexName: string, cb?: (builder: typeof noopIndexBuilder) => unknown) => {
|
||||
cb?.(noopIndexBuilder)
|
||||
return {
|
||||
collect: vi.fn(async () => categories),
|
||||
}
|
||||
}),
|
||||
collect: vi.fn(async () => categories),
|
||||
}
|
||||
}
|
||||
|
||||
if (table === "ticketEvents") {
|
||||
return {
|
||||
withIndex: vi.fn((_indexName: string, cb?: (builder: { eq: (field: unknown, value: unknown) => unknown }) => unknown) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue