From 771e25798d7170c74f24147d31ec88324de8f489 Mon Sep 17 00:00:00 2001 From: esdrasrenan Date: Tue, 16 Dec 2025 19:34:25 -0300 Subject: [PATCH] fix(checklist): corrige exibicao da descricao do template no ticket MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O campo templateDescription nao estava sendo exibido porque o schema Zod em src/lib/mappers/ticket.ts nao incluia esse campo, fazendo com que ele fosse removido durante a validacao dos dados do servidor. - Adiciona templateDescription ao schema Zod do checklist - Remove logs de debug dos arquivos de backend e frontend 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- convex/checklistTemplates.ts | 8 -------- convex/tickets.ts | 17 ----------------- .../tickets/ticket-checklist-card.tsx | 14 +------------- src/lib/mappers/ticket.ts | 1 + 4 files changed, 2 insertions(+), 38 deletions(-) diff --git a/convex/checklistTemplates.ts b/convex/checklistTemplates.ts index 2ec9d28..c9329b5 100644 --- a/convex/checklistTemplates.ts +++ b/convex/checklistTemplates.ts @@ -232,14 +232,6 @@ export const create = mutation({ const archivedFlag = typeof isArchived === "boolean" ? isArchived : false const now = Date.now() - // DEBUG: Verificar descrição sendo salva - console.log("[DEBUG create template]", { - name: normalizedName, - descriptionInput: description, - normalizedDescription, - willSave: normalizedDescription ?? undefined, - }) - return ctx.db.insert("ticketChecklistTemplates", { tenantId, name: normalizedName, diff --git a/convex/tickets.ts b/convex/tickets.ts index 975bb1f..fa79353 100644 --- a/convex/tickets.ts +++ b/convex/tickets.ts @@ -2807,24 +2807,7 @@ export const applyChecklistTemplate = mutation({ const now = Date.now(); const current = normalizeTicketChecklist(ticketDoc.checklist); - // DEBUG: Verificar se o template tem description - console.log("[DEBUG applyChecklistTemplate] Template:", { - id: String(template._id), - name: template.name, - description: template.description, - hasDescription: Boolean(template.description), - }); const result = applyChecklistTemplateToItems(current, template, { now, actorId }); - // DEBUG: Verificar resultado com templateDescription - console.log("[DEBUG applyChecklistTemplate] Result:", { - added: result.added, - items: result.checklist.map(item => ({ - id: item.id, - text: item.text.substring(0, 20), - templateDescription: item.templateDescription, - hasTemplateDesc: Boolean(item.templateDescription), - })), - }); if (result.added === 0) { return { ok: true, added: 0 }; } diff --git a/src/components/tickets/ticket-checklist-card.tsx b/src/components/tickets/ticket-checklist-card.tsx index 8b078d8..4c5ddab 100644 --- a/src/components/tickets/ticket-checklist-card.tsx +++ b/src/components/tickets/ticket-checklist-card.tsx @@ -1,6 +1,6 @@ "use client" -import { useEffect, useMemo, useState } from "react" +import { useMemo, useState } from "react" import { useMutation, useQuery } from "convex/react" import { CheckCheck, ListChecks, Plus, RotateCcw, Trash2 } from "lucide-react" import { toast } from "sonner" @@ -49,18 +49,6 @@ export function TicketChecklistCard({ const isResolved = ticket.status === "RESOLVED" const checklist = useMemo(() => ticket.checklist ?? [], [ticket.checklist]) - - // DEBUG: Verificar dados do checklist - useEffect(() => { - if (checklist.length > 0) { - console.log("[DEBUG] Checklist items:", checklist.map(item => ({ - id: item.id, - text: item.text.substring(0, 30), - templateDescription: item.templateDescription, - description: item.description, - }))) - } - }, [checklist]) const requiredTotal = useMemo(() => checklist.filter((item) => (item.required ?? true)).length, [checklist]) const requiredDone = useMemo(() => countRequiredDone(checklist), [checklist]) const requiredPending = useMemo(() => countRequiredPending(checklist), [checklist]) diff --git a/src/lib/mappers/ticket.ts b/src/lib/mappers/ticket.ts index f83def8..3fdd655 100644 --- a/src/lib/mappers/ticket.ts +++ b/src/lib/mappers/ticket.ts @@ -94,6 +94,7 @@ const serverTicketSchema = z.object({ required: z.boolean().optional(), templateId: z.string().optional(), templateItemId: z.string().optional(), + templateDescription: z.string().optional(), createdAt: z.number().optional(), createdBy: z.string().optional(), doneAt: z.number().optional(),