Initial commit: BI Agentes platform

Independent dashboard for CambioReal agents with local SQLite auth
and read-only RDS connection. Features login, per-agent transaction
filtering, KPIs, charts (Chart.js), and detailed transaction table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 15:47:07 -05:00
commit 39900c3fe8
14 changed files with 3006 additions and 0 deletions

26
src/db-local.js Normal file
View File

@@ -0,0 +1,26 @@
/**
* SQLite local — controle de agentes (auth + config)
*/
const Database = require('better-sqlite3');
const path = require('path');
const DB_PATH = path.join(__dirname, '..', 'data', 'agentes.db');
const db = new Database(DB_PATH);
// WAL mode for better concurrency
db.pragma('journal_mode = WAL');
// Create tables
db.exec(`
CREATE TABLE IF NOT EXISTS agentes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
email TEXT UNIQUE NOT NULL,
senha_hash TEXT NOT NULL,
agente_id INTEGER NOT NULL,
nome TEXT NOT NULL,
ativo INTEGER DEFAULT 1,
created_at TEXT DEFAULT (datetime('now'))
)
`);
module.exports = db;