initial push from external dev branches

This commit is contained in:
iFlip721
2026-06-11 16:40:21 -04:00
parent 986e83632b
commit 245034a43a
182 changed files with 15465 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import { Router } from 'express';
import { Program } from '../models/Program.js';
export const programsRouter = Router();
// All programs, grouped by channelId — matches the EPG_PROGRAMS shape the SPA expects.
programsRouter.get('/', async (_req, res, next) => {
try {
const docs = await Program.find({}, { _id: 0 }).sort({ channelId: 1, start: 1 }).lean();
const grouped: Record<string, Array<{ start: number; end: number; title: string; cat: string }>> = {};
for (const d of docs) {
const list = grouped[d.channelId] ?? (grouped[d.channelId] = []);
list.push({ start: d.start, end: d.end, title: d.title, cat: d.cat });
}
res.json(grouped);
} catch (err) {
next(err);
}
});