listo carga completa de los datos en indexDB
This commit is contained in:
@@ -4,5 +4,12 @@ export const vistaResumenIngresosConfig: TableConfig = {
|
||||
name: 'vista_resumen_ingresos',
|
||||
table: 'vista_resumen_ingresos',
|
||||
primaryKey: 'id',
|
||||
defaultSelect: '*, fecha as created_at'
|
||||
defaultSelect: '*',
|
||||
transforms: {
|
||||
// Map fecha to created_at for consistency
|
||||
serializeRow: (row: any) => ({
|
||||
...row,
|
||||
created_at: row.fecha || row.created_at
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -4,5 +4,12 @@ export const vistaResumenIngresosPorComercioConfig: TableConfig = {
|
||||
name: 'vista_resumen_ingresos_por_comercio',
|
||||
table: 'vista_resumen_ingresos_por_comercio',
|
||||
primaryKey: 'id',
|
||||
defaultSelect: '*, fecha as created_at'
|
||||
defaultSelect: '*',
|
||||
transforms: {
|
||||
// Map fecha to created_at for consistency
|
||||
serializeRow: (row: any) => ({
|
||||
...row,
|
||||
created_at: row.fecha || row.created_at
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -72,17 +72,20 @@ export async function fetchTableMetadata(tableName: string, options?: MetadataOp
|
||||
)
|
||||
.limit(1)
|
||||
|
||||
// Try to get created_at range, but don't fail if the column doesn't exist
|
||||
// Try to get created_at range
|
||||
// For views with 'fecha' field, try that first, otherwise use 'created_at'
|
||||
const orderField = baseSelect.includes('fecha') ? 'fecha' : 'created_at'
|
||||
|
||||
const earliestPromise = supabase
|
||||
.from(config.table)
|
||||
.select('created_at')
|
||||
.order('created_at', { ascending: true })
|
||||
.select(baseSelect)
|
||||
.order(orderField, { ascending: true })
|
||||
.limit(1)
|
||||
|
||||
const latestPromise = supabase
|
||||
.from(config.table)
|
||||
.select('created_at')
|
||||
.order('created_at', { ascending: false })
|
||||
.select(baseSelect)
|
||||
.order(orderField, { ascending: false })
|
||||
.limit(1)
|
||||
|
||||
const [sampleResult, earliestResult, latestResult] =
|
||||
|
||||
Reference in New Issue
Block a user