Actualizar server.js
This commit is contained in:
11
server.js
11
server.js
@@ -1015,10 +1015,15 @@ app.post("/public/new-request", async (req, res) => {
|
|||||||
VALUES ($1, $2, $3, CURRENT_TIMESTAMP + INTERVAL '5 minutes')
|
VALUES ($1, $2, $3, CURRENT_TIMESTAMP + INTERVAL '5 minutes')
|
||||||
`, [newServiceId, worker.id, token]);
|
`, [newServiceId, worker.id, 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
|
// Enviamos el WA al operario
|
||||||
const msg = `🚨 *URGENCIA PARTICULAR (WEB)*\n📍 Zona: Asignada\n🔗 https://web.integrarepara.es/aceptar.html?t=${token}`;
|
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);
|
sendWhatsAppAuto(worker.phone, msg, `cliente_${targetOwnerId}`, false).catch(console.error);
|
||||||
|
|
||||||
// Dejamos huella
|
// Dejamos huella
|
||||||
|
|||||||
Reference in New Issue
Block a user