mejoras UI 4

This commit is contained in:
2025-09-26 18:14:15 -06:00
parent 689f80d59c
commit e10d8950d9
5 changed files with 153 additions and 32 deletions

View File

@@ -151,4 +151,15 @@ router.post('/vlans', async (req, res) => {
}
});
// Devices list (read-only)
router.get('/devices', async (_req, res) => {
try {
const result = await pool.query('SELECT id, mac, nombre, vendor, descripcion, first_seen, last_seen FROM dispositivos ORDER BY last_seen DESC NULLS LAST, first_seen DESC');
res.json({ items: result.rows });
} catch (e) {
console.error('GET /api/devices error:', e?.message || e);
res.status(500).json({ ok: false, error: 'db_error', items: [] });
}
});
export default router;