- Backend: /history/years and /history/:year return every movie and episode watch in a year, with entry posters, genres, networks and buddies - History tab: watches by month and day, back-to-back episodes grouped - Timeline tab: latest to oldest, month dividers, stacked binge sessions - Year in Review tab: hours, top shows and genres, streaks, busiest day, biggest binge, monthly and weekday charts, buddies and new shows - Year picker, movies/TV filter, state kept in the URL; unknown-date watches badged and excluded from the review by default - History link in the sidebar and command palette
25 lines
653 B
JavaScript
25 lines
653 B
JavaScript
const express = require("express");
|
|
const historyRouter = express.Router();
|
|
|
|
const historyService = require("../services/historyService");
|
|
const asyncWrapper = require("../utils/asyncWrapper");
|
|
|
|
// ! /history
|
|
// * GET - Years that have watches, with movie/episode counts
|
|
historyRouter.get(
|
|
"/years",
|
|
asyncWrapper(async (req, res) => {
|
|
res.status(200).json(await historyService.getYears());
|
|
}),
|
|
);
|
|
|
|
// * GET - Every movie/episode watch in a year (newest first)
|
|
historyRouter.get(
|
|
"/:year",
|
|
asyncWrapper(async (req, res) => {
|
|
res.status(200).json(await historyService.getYear(req.params.year));
|
|
}),
|
|
);
|
|
|
|
module.exports = historyRouter;
|