Actualizar server.js

This commit is contained in:
2026-03-03 22:23:47 +00:00
parent a8d3b7a4d1
commit d2ab1c7ecf

View File

@@ -1200,6 +1200,17 @@ app.post("/providers/automate/:id", authMiddleware, async (req, res) => {
}); });
// AÑADIDO Y BLINDADO: CAPTURA COMPLETA, REGLA WA MANUAL, DESASIGNACIÓN Y BORRADO DE FECHA // AÑADIDO Y BLINDADO: CAPTURA COMPLETA, REGLA WA MANUAL, DESASIGNACIÓN Y BORRADO DE FECHA
app.put('/providers/scraped/:id', authMiddleware, async (req, res) => {
const { id } = req.params;
let { automation_status, status, name, phone, address, cp, description, guild_id, assigned_to, assigned_to_name, internal_notes, client_notes, is_urgent, ...extra } = req.body;
try {
// 1. Cambio de estado de automatización (ej. detener bolsa)
if (automation_status) {
await pool.query(`UPDATE scraped_services SET automation_status = $1 WHERE id = $2 AND owner_id = $3`, [automation_status, id, req.user.accountId]);
return res.json({ ok: true });
}
// ESCUDO ANTI-ARCHIVO Y LOG AUTOMÁTICO // ESCUDO ANTI-ARCHIVO Y LOG AUTOMÁTICO
if (status === 'archived') { if (status === 'archived') {
const checkQ = await pool.query(` const checkQ = await pool.query(`