Actualizar server.js
This commit is contained in:
12
server.js
12
server.js
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user