Actualizar server.js
This commit is contained in:
@@ -1015,9 +1015,14 @@ app.post("/public/new-request", async (req, res) => {
|
||||
VALUES ($1, $2, $3, CURRENT_TIMESTAMP + INTERVAL '5 minutes')
|
||||
`, [newServiceId, worker.id, token]);
|
||||
|
||||
// Enviamos el WA al operario
|
||||
const msg = `🚨 *URGENCIA PARTICULAR (WEB)*\n📍 Zona: Asignada\n🔗 https://web.integrarepara.es/aceptar.html?t=${token}`;
|
||||
// Extraemos solo la calle (Corta al encontrar el primer número o un s/n)
|
||||
let calleOculta = "Zona por determinar";
|
||||
if (address) {
|
||||
calleOculta = address.replace(/\s*,?\s*(\d+|s\/n).*$/i, '').trim();
|
||||
}
|
||||
|
||||
// Enviamos el WA al operario
|
||||
const msg = `🚨 *URGENCIA PARTICULAR (WEB)*\n📍 Calle: ${calleOculta}\n🔗 https://web.integrarepara.es/aceptar.html?t=${token}`;
|
||||
|
||||
sendWhatsAppAuto(worker.phone, msg, `cliente_${targetOwnerId}`, false).catch(console.error);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user