debug(checklist): adiciona logs para investigar templateDescription
Adiciona: - Query debugTemplateAndTicketChecklist para verificar dados no backend - Console.log no frontend para verificar dados recebidos Esses logs serao removidos apos identificar o problema. 🤖 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
58cda4f6ea
commit
db73e87cdc
2 changed files with 62 additions and 1 deletions
|
|
@ -325,3 +325,52 @@ export const remove = mutation({
|
|||
return { ok: true }
|
||||
},
|
||||
})
|
||||
|
||||
// DEBUG: Query para verificar dados do template e checklist de um ticket
|
||||
export const debugTemplateAndTicketChecklist = query({
|
||||
args: {
|
||||
tenantId: v.string(),
|
||||
viewerId: v.id("users"),
|
||||
templateId: v.id("ticketChecklistTemplates"),
|
||||
ticketId: v.optional(v.id("tickets")),
|
||||
},
|
||||
handler: async (ctx, { tenantId, viewerId, templateId, ticketId }) => {
|
||||
await requireStaff(ctx, viewerId, tenantId)
|
||||
|
||||
const template = await ctx.db.get(templateId)
|
||||
if (!template || template.tenantId !== tenantId) {
|
||||
return { error: "Template nao encontrado" }
|
||||
}
|
||||
|
||||
const templateData = {
|
||||
id: String(template._id),
|
||||
name: template.name,
|
||||
description: template.description,
|
||||
hasDescription: Boolean(template.description),
|
||||
descriptionType: typeof template.description,
|
||||
itemsCount: template.items?.length ?? 0,
|
||||
}
|
||||
|
||||
let ticketData = null
|
||||
if (ticketId) {
|
||||
const ticket = await ctx.db.get(ticketId)
|
||||
if (ticket && ticket.tenantId === tenantId) {
|
||||
ticketData = {
|
||||
id: String(ticket._id),
|
||||
checklistCount: ticket.checklist?.length ?? 0,
|
||||
checklistItems: (ticket.checklist ?? []).map((item) => ({
|
||||
id: item.id,
|
||||
text: item.text.substring(0, 50),
|
||||
templateId: item.templateId ? String(item.templateId) : null,
|
||||
templateDescription: item.templateDescription,
|
||||
hasTemplateDescription: Boolean(item.templateDescription),
|
||||
description: item.description,
|
||||
hasDescription: Boolean(item.description),
|
||||
})),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { template: templateData, ticket: ticketData }
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue