From 7f8a469cef8e833fca2d7b0eb415d905ec8e91f7 Mon Sep 17 00:00:00 2001 From: marsalva Date: Fri, 13 Feb 2026 18:15:17 +0000 Subject: [PATCH] Actualizar server.js --- server.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index a0c1a7e..d80e37f 100644 --- a/server.js +++ b/server.js @@ -21,7 +21,7 @@ const { // --- DIAGNÓSTICO DE INICIO --- console.log("------------------------------------------------"); -console.log("🚀 VERSIÓN NUEVA CARGADA - CON MAPEADOR REAL"); // <--- AHORA SÍ +console.log("🚀 VERSIÓN NUEVA CARGADA - CON MAPEADOR REAL"); console.log("------------------------------------------------"); if (!DATABASE_URL) console.error("❌ FALTA: DATABASE_URL"); if (!JWT_SECRET) console.error("❌ FALTA: JWT_SECRET"); @@ -486,6 +486,19 @@ app.get("/discovery/keys/:provider", authMiddleware, async (req, res) => { } }); +// RUTA NUEVA: Entrega todos los mapeos guardados por el usuario +app.get("/discovery/mappings", authMiddleware, async (req, res) => { + try { + const q = await pool.query( + "SELECT provider, original_key, target_key FROM variable_mappings WHERE owner_id = $1", + [req.user.accountId] + ); + res.json(q.rows); + } catch (e) { + res.status(500).json({ ok: false, error: e.message }); + } +}); + app.post("/discovery/save", authMiddleware, async (req, res) => { const client = await pool.connect(); try {