feat: surface ticket work metrics and refresh list layout

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
esdrasrenan 2025-10-04 22:22:02 -03:00
parent 744d5933d4
commit 55511f3a0e
20 changed files with 1102 additions and 357 deletions

View file

@ -32,6 +32,19 @@ const serverTicketSchema = z.object({
tags: z.array(z.string()).default([]).optional(),
lastTimelineEntry: z.string().nullable().optional(),
metrics: z.any().nullable().optional(),
workSummary: z
.object({
totalWorkedMs: z.number(),
activeSession: z
.object({
id: z.string(),
agentId: z.string(),
startedAt: z.number(),
})
.nullable(),
})
.nullable()
.optional(),
});
const serverAttachmentSchema = z.object({
@ -75,6 +88,17 @@ export function mapTicketFromServer(input: unknown) {
dueAt: s.dueAt ? new Date(s.dueAt) : null,
firstResponseAt: s.firstResponseAt ? new Date(s.firstResponseAt) : null,
resolvedAt: s.resolvedAt ? new Date(s.resolvedAt) : null,
workSummary: s.workSummary
? {
totalWorkedMs: s.workSummary.totalWorkedMs,
activeSession: s.workSummary.activeSession
? {
...s.workSummary.activeSession,
startedAt: new Date(s.workSummary.activeSession.startedAt),
}
: null,
}
: undefined,
};
return ui as unknown as z.infer<typeof ticketSchema>;
}
@ -100,6 +124,17 @@ export function mapTicketWithDetailsFromServer(input: unknown) {
createdAt: new Date(c.createdAt),
updatedAt: new Date(c.updatedAt),
})),
workSummary: s.workSummary
? {
totalWorkedMs: s.workSummary.totalWorkedMs,
activeSession: s.workSummary.activeSession
? {
...s.workSummary.activeSession,
startedAt: new Date(s.workSummary.activeSession.startedAt),
}
: null,
}
: undefined,
};
return ui as unknown as z.infer<typeof ticketWithDetailsSchema>;
}