Bunch of buag fixes and updates

This commit is contained in:
2025-09-24 12:37:26 -06:00
parent feb2e72c9a
commit f35a1f4be5
33 changed files with 3085 additions and 200 deletions

View File

@@ -41,6 +41,21 @@ router.post(
);
// Email endpoints
router.post(
'/emails/preview',
rateLimiter.general,
[
body('recipientEmail').isEmail().withMessage('Valid recipient email is required'),
body('senderName').notEmpty().withMessage('Sender name is required'),
body('senderEmail').isEmail().withMessage('Valid sender email is required'),
body('subject').notEmpty().withMessage('Subject is required'),
body('message').notEmpty().withMessage('Message is required'),
body('postalCode').matches(/^[A-Za-z]\d[A-Za-z]\s?\d[A-Za-z]\d$/).withMessage('Invalid postal code format')
],
handleValidationErrors,
emailsController.previewEmail
);
router.post(
'/emails/send',
rateLimiter.email, // General hourly rate limit
@@ -58,19 +73,6 @@ router.post(
);
// 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,