Actualizar server.js
This commit is contained in:
16
server.js
16
server.js
@@ -364,13 +364,15 @@ app.post("/public/assignment/respond", async (req, res) => {
|
||||
|
||||
// ACCIÓN CLAVE: Actualizamos el servicio con el operario asignado
|
||||
// Guardamos el user_id en el JSON raw_data para que el panel lo lea correctamente
|
||||
await client.query(`
|
||||
UPDATE scraped_services
|
||||
SET status = 'imported',
|
||||
automation_status = 'completed',
|
||||
raw_data = raw_data || jsonb_build_object('assigned_to', $1)
|
||||
WHERE id = $2
|
||||
`, [ping.user_id, ping.scraped_id]);
|
||||
// Sustituye el UPDATE dentro de action === 'accept'
|
||||
await client.query(`
|
||||
UPDATE scraped_services
|
||||
SET status = 'imported',
|
||||
automation_status = 'completed',
|
||||
assigned_to = $1,
|
||||
raw_data = raw_data || jsonb_build_object('assigned_to', $1)
|
||||
WHERE id = $2
|
||||
`, [ping.user_id, ping.scraped_id]);
|
||||
|
||||
} else {
|
||||
await client.query("UPDATE assignment_pings SET status = 'rejected', expires_at = NOW() WHERE id = $1", [ping.id]);
|
||||
|
||||
Reference in New Issue
Block a user