Actualizar server.js
This commit is contained in:
@@ -644,13 +644,12 @@ app.get("/services/active", authMiddleware, async (req, res) => {
|
|||||||
app.put("/services/set-appointment/:id", authMiddleware, async (req, res) => {
|
app.put("/services/set-appointment/:id", authMiddleware, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
const { date, time } = req.body;
|
const { date, time, status_operativo } = req.body;
|
||||||
// Actualizamos raw_data inyectando la fecha y hora
|
|
||||||
await pool.query(`
|
await pool.query(`
|
||||||
UPDATE scraped_services
|
UPDATE scraped_services
|
||||||
SET raw_data = raw_data || jsonb_build_object('scheduled_date', $1, 'scheduled_time', $2)
|
SET raw_data = raw_data || jsonb_build_object('scheduled_date', $1, 'scheduled_time', $2, 'status_operativo', $3)
|
||||||
WHERE id = $3 AND owner_id = $4
|
WHERE id = $4 AND owner_id = $5
|
||||||
`, [date, time, id, req.user.accountId]);
|
`, [date, time, status_operativo, id, req.user.accountId]);
|
||||||
res.json({ ok: true });
|
res.json({ ok: true });
|
||||||
} catch (e) { res.status(500).json({ ok: false }); }
|
} catch (e) { res.status(500).json({ ok: false }); }
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user