Actualizar server.js

This commit is contained in:
2026-02-16 07:45:52 +00:00
parent 8945f78e71
commit c65241393d

View File

@@ -331,12 +331,12 @@ async function ensureInstance(instanceName) {
app.get("/public/assignment/:token", async (req, res) => {
try {
const { token } = req.params;
const q = await pool.query(`
SELECT ap.*, s.raw_data, u.full_name as worker_name
FROM assignment_pings ap
JOIN scraped_services s ON ap.scraped_id = s.id
JOIN users u ON ap.user_id = u.id
WHERE ap.token = $1 AND ap.status = 'pending' AND ap.expires_at > NOW()
const q = await pool.query(`
SELECT ap.*, s.raw_data, u.full_name as worker_name
FROM assignment_pings ap
JOIN scraped_services s ON ap.scraped_id = s.id
JOIN users u ON ap.user_id = u.id
WHERE ap.token = $1 AND ap.status = 'pending' AND ap.expires_at > NOW()
`, [token]);
if (q.rowCount === 0) return res.status(404).json({ ok: false, error: "Enlace caducado" });
res.json({ ok: true, service: q.rows[0].raw_data, worker: q.rows[0].worker_name });