Baseline commit of the existing Maquina Comercial Pessoal project
Tracks the app that was already in place (capture, treatment, outreach, WhatsApp integration, server, frontend, tests, docs) so future feature work can branch and use isolated worktrees.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { loadDotEnv, paths } from '../src/env.mjs';
|
||||
import { openDb, ensureSeeds } from '../src/db.mjs';
|
||||
import { runOutreachBatch } from '../src/outreach/run.mjs';
|
||||
import { createWhatsAppManager, hasWhatsAppSession } from '../src/whatsapp/manager.mjs';
|
||||
|
||||
// Dispara um lote pela sessao local existente, respeitando as mesmas regras do servidor.
|
||||
|
||||
await loadDotEnv();
|
||||
|
||||
const log = (message) => console.log(`[outreach] ${message}`);
|
||||
|
||||
const db = openDb();
|
||||
await ensureSeeds(db, { log });
|
||||
const whatsapp = createWhatsAppManager({ authDir: paths.whatsappAuth, log });
|
||||
if (await hasWhatsAppSession(paths.whatsappAuth)) {
|
||||
await whatsapp.connect().catch((error) => log(`conexao local falhou: ${error.message}`));
|
||||
}
|
||||
|
||||
const resumo = await runOutreachBatch({ db, whatsapp, log });
|
||||
console.log(JSON.stringify(resumo, null, 2));
|
||||
|
||||
await whatsapp.close();
|
||||
db.close();
|
||||
Reference in New Issue
Block a user