- const [ categories, channels, tags ] = await Promise.all([
- Promise.all(attributes.categories.map(c => getVideosByCategory(c, res))),
- Promise.all(attributes.channels.map(c => getVideosByChannel(c, res))),
- Promise.all(attributes.tags.map(t => getVideosByTag(t, res)))
+ const page = req.query.page || 1
+ const index = page - 1
+
+ const categories: CategoryOverview[] = []
+ const channels: ChannelOverview[] = []
+ const tags: TagOverview[] = []
+
+ await Promise.all([
+ getVideosByCategory(attributes.categories, index, res, categories),
+ getVideosByChannel(attributes.channels, index, res, channels),
+ getVideosByTag(attributes.tags, index, res, tags)