@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
25 lines (22 loc) • 1.01 kB
JavaScript
import { Router } from 'express';
import { DownloadReportController } from './controller.js';
import routes from './request-download/routes.js';
/* eslint-disable no-param-reassign */
function Routes({ layoutPath, services }) {
const router = Router({ mergeParams: true });
const controller = new DownloadReportController(layoutPath, services);
// Download report
router.post(['/:reportId/:id/tableId/:tableId', '/:reportId/:id'], controller.POST);
// Request download form routes
router.use([`/request-download/:reportId/:variantId/tableId/:tableId`, `/request-download/:reportId/:variantId`], routes({ layoutPath, services }));
return router;
}
const DownloadReportRoutes = ({ services, path, layoutPath, }) => {
const router = Router({ mergeParams: true });
if (services.downloadPermissionService.enabled) {
router.use(path, Routes({ services, layoutPath }));
}
return router;
};
export { DownloadReportRoutes, Routes };
//# sourceMappingURL=routes.js.map