Agregar tab de pendientes, categoria procedimiento y fecha/hora programada

This commit is contained in:
2026-08-11 20:20:04 +00:00
parent ca2f8a32e1
commit a700c40d20
5 changed files with 599 additions and 2 deletions
+39
View File
@@ -16,6 +16,7 @@ import { initDb,
getAllAtb, createAtb, updateAtb, deleteAtb,
getAllIndicaciones, createIndicacion, updateIndicacion, deleteIndicacion,
getAllMovimientosIndicaciones, createMovimientoIndicacion,
getAllPendientes, createPendiente, updatePendiente, deletePendiente,
getValue, setValue
} from './db-mongodb.js';
@@ -63,6 +64,7 @@ app.get('/api/state', async (req, res) => {
atb: await getAllAtb(),
indicaciones: await getAllIndicaciones(),
movimientosIndicaciones: await getAllMovimientosIndicaciones(),
pendientes: await getAllPendientes(),
usuarios: usuariosList.map(({ passwordHash, ...u }) => u),
vistaActual: 'dashboard',
currentInternacionId: null
@@ -656,6 +658,43 @@ app.post('/api/movimientos-indicaciones', async (req, res) => {
}
});
// ========== PENDIENTES ==========
app.get('/api/pendientes', async (req, res) => {
try {
res.json(await getAllPendientes());
} catch (err) {
res.status(500).json({ error: 'Error al obtener pendientes' });
}
});
app.post('/api/pendientes', async (req, res) => {
try {
const pendiente = { ...req.body, id: req.body.id || generateUUID() };
await createPendiente(pendiente);
res.json(pendiente);
} catch (err) {
res.status(500).json({ error: 'Error al crear pendiente' });
}
});
app.put('/api/pendientes/:id', async (req, res) => {
try {
await updatePendiente(req.params.id, req.body);
res.json({ ok: true });
} catch (err) {
res.status(500).json({ error: 'Error al actualizar pendiente' });
}
});
app.delete('/api/pendientes/:id', async (req, res) => {
try {
await deletePendiente(req.params.id);
res.json({ ok: true });
} catch (err) {
res.status(500).json({ error: 'Error al eliminar pendiente' });
}
});
// ========== AUTH ==========
app.post('/api/auth/login', async (req, res) => {
try {