From e39b6bd7a9f6aaf47f6dc1abe91f2d2039ebe2c2 Mon Sep 17 00:00:00 2001 From: marsalva Date: Mon, 16 Mar 2026 22:23:14 +0000 Subject: [PATCH] Actualizar server.js --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 5a09407..2e0a201 100644 --- a/server.js +++ b/server.js @@ -987,10 +987,11 @@ app.post("/public/new-request", async (req, res) => { try { const { phone, name, address, guild_id, description, is_urgent, owner_id } = req.body; - if (!phone || !guild_id) return res.status(400).json({ ok: false, error: "Faltan datos clave" }); + // 🚨 CAMBIO SAAS: Obligamos a que venga el owner_id sí o sí + if (!phone || !guild_id || !owner_id) return res.status(400).json({ ok: false, error: "Faltan datos clave de la empresa" }); // 🛡️ CONVERSIÓN ESTRICTA DE DATOS (Para que PostgreSQL no lance Error 500) - const targetOwnerId = parseInt(owner_id) || 1; + const targetOwnerId = parseInt(owner_id); // Quitamos el "|| 1" para que no asigne a la Empresa 1 por error const safeGuildId = parseInt(guild_id) || 0; const isUrgentBool = is_urgent === true || is_urgent === 'true'; const cleanPhone = String(phone).replace(/\D/g, "");