mirror of
https://github.com/TheBinaryNinja/tvapp2.git
synced 2026-06-12 15:05:41 -04:00
initial push from external dev branches
This commit is contained in:
22
server/dist/routes/channels.js
vendored
Normal file
22
server/dist/routes/channels.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Router } from 'express';
|
||||
import { Channel } from '../models/Channel.js';
|
||||
import { SourceChannel } from '../models/SourceChannel.js';
|
||||
export const channelsRouter = Router();
|
||||
// GET /api/channels → legacy mock channels (drives the existing dashboard bootstrap)
|
||||
// GET /api/channels?source=<id> → canonical normalized SourceChannel docs for a (Default) source
|
||||
// playlist (the d-combine "path forward" contract, served over Mongo)
|
||||
channelsRouter.get('/', async (req, res, next) => {
|
||||
try {
|
||||
const source = typeof req.query.source === 'string' ? req.query.source : null;
|
||||
if (source) {
|
||||
const docs = await SourceChannel.find({ source }).sort({ groupKey: 1, name: 1 }).lean();
|
||||
return res.json(docs);
|
||||
}
|
||||
const docs = await Channel.find({}, { _id: 0 }).lean();
|
||||
res.json(docs);
|
||||
}
|
||||
catch (err) {
|
||||
next(err);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=channels.js.map
|
||||
Reference in New Issue
Block a user