email sent when personal information changed

This commit is contained in:
jackiettran
2025-11-21 16:47:39 -05:00
parent f7767dfd13
commit f2d42dffee
9 changed files with 701 additions and 153 deletions

View File

@@ -32,6 +32,7 @@ const feedbackRoutes = require("./routes/feedback");
const PayoutProcessor = require("./jobs/payoutProcessor");
const RentalStatusJob = require("./jobs/rentalStatusJob");
const ConditionCheckReminderJob = require("./jobs/conditionCheckReminder");
const emailServices = require("./services/email");
// Socket.io setup
const { authenticateSocket } = require("./sockets/socketAuth");
@@ -166,9 +167,27 @@ const PORT = process.env.PORT || 5000;
sequelize
.sync({ alter: true })
.then(() => {
.then(async () => {
logger.info("Database synced successfully");
// Initialize email services and load templates
try {
await emailServices.initialize();
logger.info("Email services initialized successfully");
} catch (err) {
logger.error("Failed to initialize email services", {
error: err.message,
stack: err.stack,
});
// Fail fast - don't start server if email templates can't load
if (env === "prod" || env === "production") {
logger.error("Cannot start server without email services in production");
process.exit(1);
} else {
logger.warn("Email services failed to initialize - continuing in dev mode");
}
}
// Start the payout processor
const payoutJobs = PayoutProcessor.startScheduledPayouts();
logger.info("Payout processor started");