feat(live): paginate catalog and search server-side (#49)

Load Live channels from a filtered SQLite cursor API, keep navigation and guide consumers working across pages, and retain the QA reproduction coverage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 22:43:29 +02:00
parent 8239e6043b
commit e2249154a5
13 changed files with 1280 additions and 387 deletions

View File

@ -1,6 +1,20 @@
const express = require('express');
const router = express.Router();
const { getDb } = require('../db/sqlite');
const { sources } = require('../db');
const { parseQuery, getLiveCatalog } = require('../services/liveCatalog');
router.get('/live-catalog', async (req, res) => {
try {
const options = parseQuery(req.query, req.user.id);
const result = getLiveCatalog(getDb(), await sources.getAll(), options);
res.json(result);
} catch (error) {
if (error.status === 400) return res.status(400).json({ error: error.message });
console.error('Error getting live catalog:', error);
res.status(500).json({ error: 'Failed to get live catalog' });
}
});
// Helper to map API item types to DB types and tables
function mapItemType(apiType) {