Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
router.get('/download', async (req, res, next) => {
try {
const query = {};
if (_.has(req, 'aom.siren')) {
query['aom.siren'] = req.aom.siren;
}
if (_.has(req, 'operator.siren')) {
query['operator.siren'] = req.operator.siren;
}
res
.set('Content-type', 'text/csv')
.send(await proofService.convert(await Proof.find(query), 'csv'));
} catch (e) {
next(e);
}
});