app.get('/pdf-bulk-upload/:batchId/status', async (req, res) => { const { batchId } = req.params; const state = await redis.hgetall(`batch:${batchId}`); if (!state || Object.keys(state).length === 0) { return res.status(404).json({ error: 'Batch not found or expired' }); } res.json({ status: state.status, totalFiles: parseInt(state.totalFiles) || 0, processed: parseInt(state.processed) || 0, linked: parseInt(state.linked) || 0, skipped_no_match: parseInt(state.skipped_no_match) || 0, skipped_already_exists: parseInt(state.skipped_already_exists) || 0, failed: parseInt(state.failed) || 0 }); }); __ __