UNPKG

@ministryofjustice/hmpps-digital-prison-reporting-frontend

Version:

The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.

20 lines (17 loc) 881 B
import { ReportType, RequestStatus } from '../../../types/UserReports.js'; import localsHelper from '../../../utils/localsHelper.js'; const cancelRequest = async ({ req, res, services }) => { const { token, dprUser, definitionsPath } = localsHelper.getValues(res); const { reportId, id, executionId, type } = req.params; let service = services.reportingService; if (type === ReportType.REPORT) service = services.reportingService; if (type === ReportType.DASHBOARD) service = services.dashboardService; const response = await service.cancelAsyncRequest(token, reportId, id, executionId, definitionsPath); if (response && response['cancellationSucceeded']) { await services.requestedReportService.updateStatus(executionId, dprUser.id, RequestStatus.ABORTED); } }; export { cancelRequest }; //# sourceMappingURL=utils.js.map