diff --git a/infrastructure/web/routes/inbox.js b/infrastructure/web/routes/inbox.js index 0c1eb19..6ef25f6 100644 --- a/infrastructure/web/routes/inbox.js +++ b/infrastructure/web/routes/inbox.js @@ -61,6 +61,25 @@ router.get( } ) +router.get( + '^/:address/delete-all', + sanitizeAddress, + async (req, res, next) => { + try { + const mailProcessingService = req.app.get('mailProcessingService') + const mailSummaries = await mailProcessingService.getMailSummaries(req.params.address) + for (mail in mailSummaries) { + await mailProcessingService.deleteSpecificEmail(req.params.address, mailSummaries[mail].uid) + } + res.redirect(`/inbox/${req.params.address}`) + } catch (error) { + console.error('error while deleting email', error) + next(error) + } + } +) + + router.get( '^/:address/:uid/delete', sanitizeAddress, diff --git a/infrastructure/web/views/inbox.twig b/infrastructure/web/views/inbox.twig index 06b5489..d0a7efb 100644 --- a/infrastructure/web/views/inbox.twig +++ b/infrastructure/web/views/inbox.twig @@ -7,7 +7,12 @@ }); -
+