Actualizar server.js
This commit is contained in:
11
server.js
11
server.js
@@ -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
|
||||
|
||||
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
|
||||
if (status === 'archived') {
|
||||
const checkQ = await pool.query(`
|
||||
|
||||
Reference in New Issue
Block a user