debug: agregar endpoint para testear queries individuales
All checks were successful
build-and-deploy / build (push) Successful in 47s
build-and-deploy / deploy (push) Successful in 4s

This commit is contained in:
2025-10-14 10:48:03 -06:00
parent 93fb9002b2
commit 7c9d129138

View File

@@ -0,0 +1,50 @@
/**
* Test a single query to debug (temporary endpoint)
*/
export default defineEventHandler(async (event) => {
const query = getQuery(event)
const cardId = query.cardId ? parseInt(query.cardId as string) : 39 // Default to ingreso_compra
try {
console.log(`[Test] Executing card ${cardId}`)
const parameters = [
{
type: 'date/single',
target: ['variable', ['template-tag', 'fecha_desde']],
value: null
},
{
type: 'date/single',
target: ['variable', ['template-tag', 'fecha_hasta']],
value: null
},
{
type: 'category',
target: ['variable', ['template-tag', 'incluir_anulados']],
value: false
}
]
const result = await executeCardQuery(cardId, parameters)
return {
cardId,
success: true,
hasData: !!result.data,
rowCount: result.data?.rows?.length || 0,
colCount: result.data?.cols?.length || 0,
cols: result.data?.cols?.map((c: any) => c.name) || [],
firstRow: result.data?.rows?.[0] || null,
fullResult: result
}
} catch (error: any) {
console.error('[Test] Error:', error)
return {
cardId,
success: false,
error: error.message,
stack: error.stack
}
}
})