feat: add ticket category model and align ticket ui\n\nCo-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>

This commit is contained in:
esdrasrenan 2025-10-05 00:00:14 -03:00
parent 55511f3a0e
commit fab1cbe476
17 changed files with 1121 additions and 42 deletions

View file

@ -32,6 +32,21 @@ const serverTicketSchema = z.object({
tags: z.array(z.string()).default([]).optional(),
lastTimelineEntry: z.string().nullable().optional(),
metrics: z.any().nullable().optional(),
category: z
.object({
id: z.string(),
name: z.string(),
})
.nullable()
.optional(),
subcategory: z
.object({
id: z.string(),
name: z.string(),
categoryId: z.string().optional(),
})
.nullable()
.optional(),
workSummary: z
.object({
totalWorkedMs: z.number(),
@ -82,6 +97,8 @@ export function mapTicketFromServer(input: unknown) {
const s = serverTicketSchema.parse(input);
const ui = {
...s,
category: s.category ?? undefined,
subcategory: s.subcategory ?? undefined,
lastTimelineEntry: s.lastTimelineEntry ?? undefined,
updatedAt: new Date(s.updatedAt),
createdAt: new Date(s.createdAt),
@ -112,6 +129,8 @@ export function mapTicketWithDetailsFromServer(input: unknown) {
const ui = {
...s,
customFields: (s.customFields ?? {}) as Record<string, unknown>,
category: s.category ?? undefined,
subcategory: s.subcategory ?? undefined,
lastTimelineEntry: s.lastTimelineEntry ?? undefined,
updatedAt: new Date(s.updatedAt),
createdAt: new Date(s.createdAt),