chore(types): remove explicit any, fix hook deps, and unused vars across admin/api/tickets; tighten zod server schemas; adjust UI types; fix pdf export expression; minor cleanup

This commit is contained in:
Esdras Renan 2025-10-09 22:43:39 -03:00
parent 0556502685
commit 6ffd6c6392
17 changed files with 104 additions and 59 deletions

View file

@ -69,6 +69,8 @@ const serverTicketSchema = z.object({
workSummary: z
.object({
totalWorkedMs: z.number(),
internalWorkedMs: z.number().optional(),
externalWorkedMs: z.number().optional(),
activeSession: z
.object({
id: z.string(),
@ -117,6 +119,10 @@ const serverTicketWithDetailsSchema = serverTicketSchema.extend({
customFields: z.record(z.string(), serverCustomFieldValueSchema).optional(),
timeline: z.array(serverEventSchema),
comments: z.array(serverCommentSchema),
company: z
.object({ id: z.string(), name: z.string(), isAvulso: z.boolean().optional() })
.optional()
.nullable(),
});
export function mapTicketFromServer(input: unknown) {
@ -135,8 +141,8 @@ export function mapTicketFromServer(input: unknown) {
workSummary: s.workSummary
? {
totalWorkedMs: s.workSummary.totalWorkedMs,
internalWorkedMs: (s.workSummary as any).internalWorkedMs ?? 0,
externalWorkedMs: (s.workSummary as any).externalWorkedMs ?? 0,
internalWorkedMs: s.workSummary.internalWorkedMs ?? 0,
externalWorkedMs: s.workSummary.externalWorkedMs ?? 0,
activeSession: s.workSummary.activeSession
? {
...s.workSummary.activeSession,
@ -185,9 +191,7 @@ export function mapTicketWithDetailsFromServer(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,
company: (s as any).company
? ({ id: (s as any).company.id, name: (s as any).company.name, isAvulso: (s as any).company.isAvulso } as any)
: undefined,
company: s.company ? { id: s.company.id, name: s.company.name, isAvulso: s.company.isAvulso ?? false } : undefined,
timeline: s.timeline.map((e) => ({ ...e, createdAt: new Date(e.createdAt) })),
comments: s.comments.map((c) => ({
...c,