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;