feat: log de actividad por usuario
- Tabla activity_log en SQLite (migración automática) - Registra: login, login_fallido, rda_enviado, rda_masivo, rda_directo, automation_run, contrato_creado, contrato_editado, contrato_toggle - Endpoint GET /logs/actividad con filtros por usuario, acción y fecha - UI /logs/actividad con badges de color por tipo de acción - Enlace "Actividad" en navegación lateral Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
8e29e2d04f
commit
c20e1a7476
@@ -23,6 +23,18 @@ def _migrate(conn):
|
||||
conn.execute("ALTER TABLE envios ADD COLUMN mensaje_tns TEXT")
|
||||
|
||||
tables = {r[0] for r in conn.execute("SELECT name FROM sqlite_master WHERE type='table'")}
|
||||
if "activity_log" not in tables:
|
||||
conn.execute("""
|
||||
CREATE TABLE activity_log (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER,
|
||||
username TEXT NOT NULL DEFAULT '',
|
||||
accion TEXT NOT NULL,
|
||||
detalle TEXT NOT NULL DEFAULT '',
|
||||
ip TEXT NOT NULL DEFAULT '',
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
)
|
||||
""")
|
||||
if "contratos" not in tables:
|
||||
conn.execute("""
|
||||
CREATE TABLE contratos (
|
||||
|
||||
Reference in New Issue
Block a user