Actualizar server.js
This commit is contained in:
15
server.js
15
server.js
@@ -21,7 +21,7 @@ const {
|
|||||||
|
|
||||||
// --- DIAGNÓSTICO DE INICIO ---
|
// --- DIAGNÓSTICO DE INICIO ---
|
||||||
console.log("------------------------------------------------");
|
console.log("------------------------------------------------");
|
||||||
console.log("🚀 VERSIÓN NUEVA CARGADA - CON MAPEADOR REAL"); // <--- AHORA SÍ
|
console.log("🚀 VERSIÓN NUEVA CARGADA - CON MAPEADOR REAL");
|
||||||
console.log("------------------------------------------------");
|
console.log("------------------------------------------------");
|
||||||
if (!DATABASE_URL) console.error("❌ FALTA: DATABASE_URL");
|
if (!DATABASE_URL) console.error("❌ FALTA: DATABASE_URL");
|
||||||
if (!JWT_SECRET) console.error("❌ FALTA: JWT_SECRET");
|
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) => {
|
app.post("/discovery/save", authMiddleware, async (req, res) => {
|
||||||
const client = await pool.connect();
|
const client = await pool.connect();
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user