diff --git a/nuxt4-app/server/api/metabase/informe.post.ts b/nuxt4-app/server/api/metabase/informe.post.ts index 598f386..199b625 100644 --- a/nuxt4-app/server/api/metabase/informe.post.ts +++ b/nuxt4-app/server/api/metabase/informe.post.ts @@ -38,21 +38,21 @@ export default defineEventHandler(async (event) => { } // Build parameters array for Metabase queries - // Convertir null a string vacío para que las queries usen NULLIF correctamente + // Las queries SQL nativas usan template-tags de tipo 'text' para fechas, no 'date/single' const buildParameters = (includeGranularidad: boolean = false) => { const params = [ { - type: 'date/single', + type: 'text', target: ['variable', ['template-tag', 'fecha_desde']], value: fecha_desde || '' }, { - type: 'date/single', + type: 'text', target: ['variable', ['template-tag', 'fecha_hasta']], value: fecha_hasta || '' }, { - type: 'category', + type: 'boolean', target: ['variable', ['template-tag', 'incluir_anulados']], value: incluir_anulados }, @@ -62,22 +62,22 @@ export default defineEventHandler(async (event) => { value: cliente_ids }, { - type: 'category', + type: 'text', target: ['variable', ['template-tag', 'tipos']], value: tipos }, { - type: 'category', + type: 'text', target: ['variable', ['template-tag', 'estados']], value: estados }, { - type: 'category', + type: 'text', target: ['variable', ['template-tag', 'ubicaciones']], value: ubicaciones }, { - type: 'category', + type: 'text', target: ['variable', ['template-tag', 'calidades']], value: calidades } @@ -85,7 +85,7 @@ export default defineEventHandler(async (event) => { if (includeGranularidad) { params.push({ - type: 'category', + type: 'text', target: ['variable', ['template-tag', 'granularidad']], value: granularidad }) diff --git a/nuxt4-app/server/api/metabase/panorama.post.ts b/nuxt4-app/server/api/metabase/panorama.post.ts index 0342bc9..14c4470 100644 --- a/nuxt4-app/server/api/metabase/panorama.post.ts +++ b/nuxt4-app/server/api/metabase/panorama.post.ts @@ -34,20 +34,20 @@ export default defineEventHandler(async (event) => { console.log('[Panorama] Cards to execute:', Object.keys(cards)) // Build parameters array for Metabase queries - // Convertir null a string vacío para que las queries usen NULLIF correctamente + // Las queries SQL nativas usan template-tags de tipo 'text' para fechas, no 'date/single' const parameters = [ { - type: 'date/single', + type: 'text', target: ['variable', ['template-tag', 'fecha_desde']], value: fecha_desde || '' }, { - type: 'date/single', + type: 'text', target: ['variable', ['template-tag', 'fecha_hasta']], value: fecha_hasta || '' }, { - type: 'category', + type: 'boolean', target: ['variable', ['template-tag', 'incluir_anulados']], value: incluir_anulados }