Actualizar server.js

This commit is contained in:
2026-03-07 18:06:58 +00:00
parent 2f05d9e776
commit 3f241a3c55

View File

@@ -2800,6 +2800,19 @@ app.get("/worker/notifications", authMiddleware, async (req, res) => {
} }
}); });
// 4. Marcar chat como leído por el operario
app.post("/services/:id/chat/read", authMiddleware, async (req, res) => {
try {
await pool.query(
"UPDATE scraped_services SET last_chat_read_worker = NOW() WHERE id = $1 AND assigned_to = $2",
[req.params.id, req.user.sub]
);
res.json({ ok: true });
} catch (e) {
res.status(500).json({ ok: false });
}
});
// ========================================== // ==========================================
// 💬 CHAT Y COMUNICACIÓN INTERNA (TIPO iTRAMIT) // 💬 CHAT Y COMUNICACIÓN INTERNA (TIPO iTRAMIT)
// ========================================== // ==========================================