Added quick reports (at this moment only one) to campaign statistics page.
This commit is contained in:
parent
3e3c3a24fe
commit
72ffe065d2
11 changed files with 305 additions and 143 deletions
|
@ -5,6 +5,7 @@ const reports = require('../models/reports');
|
|||
const reportHelpers = require('../lib/report-helpers');
|
||||
const shares = require('../models/shares');
|
||||
const contextHelpers = require('../lib/context-helpers');
|
||||
const {castToInteger} = require('../lib/helpers');
|
||||
|
||||
const router = require('../lib/router-async').create();
|
||||
|
||||
|
@ -14,9 +15,10 @@ const fileSuffixes = {
|
|||
};
|
||||
|
||||
router.getAsync('/:id/download', passport.loggedIn, async (req, res) => {
|
||||
await shares.enforceEntityPermission(req.context, 'report', req.params.id, 'viewContent');
|
||||
const reportId = castToInteger(req.params.id);
|
||||
await shares.enforceEntityPermission(req.context, 'report', reportId, 'viewContent');
|
||||
|
||||
const report = await reports.getByIdWithTemplate(contextHelpers.getAdminContext(), req.params.id, false);
|
||||
const report = await reports.getByIdWithTemplate(contextHelpers.getAdminContext(), reportId, false);
|
||||
|
||||
if (report.state == reports.ReportState.FINISHED) {
|
||||
const headers = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue