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:
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user