feat(sat): reporte diario de errores SAT por proxy
- Agrega tabla sat_proxy_errors con proxy_usado, error_code, stage, message. - sat-client.service.ts expone proxyInfo usado en cada conexión SAT. - sat.service.ts registra errores de bloqueo/devolución del SAT en sat_proxy_errors y guarda proxyUsed en sat_sync_jobs. - Nuevo job sat-proxy-report.job.ts: cron 8 AM CDMX, envía email a ADMIN_EMAIL con errores de las últimas 24h agrupados por proxy/error_code. - Template de email sat-proxy-report.ts y método sendSatProxyReport. - Registra el cron en src/index.ts. - Actualiza docs/SAT-SYNC-IMPLEMENTATION.md.
This commit is contained in:
19
apps/api/scripts/sync-husberto-custom.ts
Normal file
19
apps/api/scripts/sync-husberto-custom.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { startSync } from '../src/services/sat/sat.service.js';
|
||||
|
||||
const TENANT_ID = 'd75bf020-2008-4881-ab96-77467bf9e1fd';
|
||||
const CONTRIBUYENTE_ID = '128c0ab0-b307-492b-bb82-7e55d390f41f';
|
||||
|
||||
async function main() {
|
||||
const dateFrom = new Date('2023-01-01T00:00:00');
|
||||
const dateTo = new Date('2026-12-31T23:59:59');
|
||||
|
||||
try {
|
||||
const jobId = await startSync(TENANT_ID, 'initial', dateFrom, dateTo, CONTRIBUYENTE_ID);
|
||||
console.log(`[SYNC] Job iniciado: ${jobId}`);
|
||||
} catch (error: any) {
|
||||
console.error('[SYNC] Error:', error.message || error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user