Tonne of updates to influence, the configs, update the homepage, and generally just did more bug testing with Influence

This commit is contained in:
2025-09-21 13:36:48 -06:00
parent b6960e45e8
commit feb2e72c9a
29 changed files with 2033 additions and 77 deletions

View File

@@ -22,6 +22,7 @@ router.get('/health', (req, res) => {
});
router.get('/test-represent', representativesController.testConnection);
router.get('/test-smtp', requireAdmin, emailsController.testSMTPConnection);
// Representatives endpoints
router.get(
@@ -42,7 +43,8 @@ router.post(
// Email endpoints
router.post(
'/emails/send',
rateLimiter.email,
rateLimiter.email, // General hourly rate limit
rateLimiter.perRecipientEmailLimiter, // Per-recipient 5-minute rate limit
[
body('recipientEmail').isEmail().withMessage('Valid email is required'),
body('senderName').notEmpty().withMessage('Sender name is required'),
@@ -55,6 +57,39 @@ router.post(
emailsController.sendEmail
);
// Email testing endpoints
router.post(
'/emails/preview',
requireAdmin,
rateLimiter.general,
[
body('recipientEmail').isEmail().withMessage('Valid recipient email is required'),
body('subject').notEmpty().withMessage('Subject is required'),
body('message').notEmpty().withMessage('Message is required')
],
handleValidationErrors,
emailsController.previewEmail
);
router.post(
'/emails/test',
requireAdmin,
rateLimiter.general,
[
body('subject').notEmpty().withMessage('Subject is required'),
body('message').notEmpty().withMessage('Message is required')
],
handleValidationErrors,
emailsController.sendTestEmail
);
router.get(
'/emails/logs',
requireAdmin,
rateLimiter.general,
emailsController.getEmailLogs
);
// Campaign endpoints (Admin) - Protected
router.get('/admin/campaigns', requireAdmin, rateLimiter.general, campaignsController.getAllCampaigns);
router.get('/admin/campaigns/:id', requireAdmin, rateLimiter.general, campaignsController.getCampaignById);
@@ -88,7 +123,8 @@ router.post(
);
router.post(
'/campaigns/:slug/send-email',
rateLimiter.email,
rateLimiter.email, // General hourly rate limit
rateLimiter.perRecipientEmailLimiter, // Per-recipient 5-minute rate limit
[
body('recipientEmail').isEmail().withMessage('Valid recipient email is required'),
body('postalCode').matches(/^[A-Za-z]\d[A-Za-z]\s?\d[A-Za-z]\d$/).withMessage('Invalid postal code format'),