fix(checklist): corrige exibicao da descricao do template no ticket
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 <noreply@anthropic.com>
This commit is contained in:
parent
8e5eccfd8e
commit
771e25798d
4 changed files with 2 additions and 38 deletions
|
|
@ -232,14 +232,6 @@ export const create = mutation({
|
||||||
const archivedFlag = typeof isArchived === "boolean" ? isArchived : false
|
const archivedFlag = typeof isArchived === "boolean" ? isArchived : false
|
||||||
const now = Date.now()
|
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", {
|
return ctx.db.insert("ticketChecklistTemplates", {
|
||||||
tenantId,
|
tenantId,
|
||||||
name: normalizedName,
|
name: normalizedName,
|
||||||
|
|
|
||||||
|
|
@ -2807,24 +2807,7 @@ export const applyChecklistTemplate = mutation({
|
||||||
|
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const current = normalizeTicketChecklist(ticketDoc.checklist);
|
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 });
|
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) {
|
if (result.added === 0) {
|
||||||
return { ok: true, added: 0 };
|
return { ok: true, added: 0 };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useEffect, useMemo, useState } from "react"
|
import { useMemo, useState } from "react"
|
||||||
import { useMutation, useQuery } from "convex/react"
|
import { useMutation, useQuery } from "convex/react"
|
||||||
import { CheckCheck, ListChecks, Plus, RotateCcw, Trash2 } from "lucide-react"
|
import { CheckCheck, ListChecks, Plus, RotateCcw, Trash2 } from "lucide-react"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
|
|
@ -49,18 +49,6 @@ export function TicketChecklistCard({
|
||||||
const isResolved = ticket.status === "RESOLVED"
|
const isResolved = ticket.status === "RESOLVED"
|
||||||
|
|
||||||
const checklist = useMemo(() => ticket.checklist ?? [], [ticket.checklist])
|
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 requiredTotal = useMemo(() => checklist.filter((item) => (item.required ?? true)).length, [checklist])
|
||||||
const requiredDone = useMemo(() => countRequiredDone(checklist), [checklist])
|
const requiredDone = useMemo(() => countRequiredDone(checklist), [checklist])
|
||||||
const requiredPending = useMemo(() => countRequiredPending(checklist), [checklist])
|
const requiredPending = useMemo(() => countRequiredPending(checklist), [checklist])
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ const serverTicketSchema = z.object({
|
||||||
required: z.boolean().optional(),
|
required: z.boolean().optional(),
|
||||||
templateId: z.string().optional(),
|
templateId: z.string().optional(),
|
||||||
templateItemId: z.string().optional(),
|
templateItemId: z.string().optional(),
|
||||||
|
templateDescription: z.string().optional(),
|
||||||
createdAt: z.number().optional(),
|
createdAt: z.number().optional(),
|
||||||
createdBy: z.string().optional(),
|
createdBy: z.string().optional(),
|
||||||
doneAt: z.number().optional(),
|
doneAt: z.number().optional(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue