debug(checklist): adiciona logs no backend para investigar

Logs adicionados:
- Na criacao do template para ver se description esta sendo salva
- Na aplicacao do template para ver se description existe

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rever-tecnologia 2025-12-16 16:28:05 -03:00
parent db73e87cdc
commit c0713875b1
3 changed files with 34 additions and 1 deletions

View file

@ -54,7 +54,25 @@
"Bash(dir:*)", "Bash(dir:*)",
"Bash(git reset:*)", "Bash(git reset:*)",
"Bash(npx convex:*)", "Bash(npx convex:*)",
"Bash(bun tsc:*)" "Bash(bun tsc:*)",
"Bash(scp:*)",
"Bash(docker run:*)",
"Bash(cmd /c \"docker run -d --name postgres-dev -p 5432:5432 -e POSTGRES_PASSWORD=dev -e POSTGRES_DB=sistema_chamados postgres:18\")",
"Bash(cmd /c \"docker ps -a --filter name=postgres-dev\")",
"Bash(cmd /c \"docker --version && docker ps -a\")",
"Bash(powershell -Command \"docker --version\")",
"Bash(powershell -Command \"docker run -d --name postgres-dev -p 5432:5432 -e POSTGRES_PASSWORD=dev -e POSTGRES_DB=sistema_chamados postgres:18\")",
"Bash(dir \"D:\\Projetos IA\\sistema-de-chamados\" /b)",
"Bash(bunx prisma migrate:*)",
"Bash(bunx prisma db push:*)",
"Bash(bun run auth:seed:*)",
"Bash(set DATABASE_URL=postgresql://postgres:dev@localhost:5432/sistema_chamados:*)",
"Bash(bun tsx:*)",
"Bash(DATABASE_URL=\"postgresql://postgres:dev@localhost:5432/sistema_chamados\" bun tsx:*)",
"Bash(docker stop:*)",
"Bash(docker rm:*)",
"Bash(git commit -m \"$(cat <<''EOF''\nfeat(checklist): exibe descricao do template e do item no ticket\n\n- Adiciona campo templateDescription ao schema do checklist\n- Copia descricao do template ao aplicar checklist no ticket\n- Exibe ambas descricoes na visualizacao do ticket (template em italico)\n- Adiciona documentacao de desenvolvimento local (docs/LOCAL-DEV.md)\n- Corrige prisma-client.mjs para usar PostgreSQL em vez de SQLite\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n)\")",
"Bash(timeout 90 git push:*)"
] ]
} }
} }

View file

@ -232,6 +232,14 @@ 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,

View file

@ -2807,6 +2807,13 @@ 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 });
if (result.added === 0) { if (result.added === 0) {
return { ok: true, added: 0 }; return { ok: true, added: 0 };