Files
rentall-app/backend/services/email/index.js
2025-11-14 17:36:35 -05:00

59 lines
2.1 KiB
JavaScript

const AuthEmailService = require("./domain/AuthEmailService");
const FeedbackEmailService = require("./domain/FeedbackEmailService");
const ForumEmailService = require("./domain/ForumEmailService");
const MessagingEmailService = require("./domain/MessagingEmailService");
const CustomerServiceEmailService = require("./domain/CustomerServiceEmailService");
const RentalFlowEmailService = require("./domain/RentalFlowEmailService");
const RentalReminderEmailService = require("./domain/RentalReminderEmailService");
const UserEngagementEmailService = require("./domain/UserEngagementEmailService");
const AlphaInvitationEmailService = require("./domain/AlphaInvitationEmailService");
/**
* EmailServices aggregates all domain-specific email services
* This class provides a unified interface to access all email functionality
*/
class EmailServices {
constructor() {
// Initialize all domain services
this.auth = new AuthEmailService();
this.feedback = new FeedbackEmailService();
this.forum = new ForumEmailService();
this.messaging = new MessagingEmailService();
this.customerService = new CustomerServiceEmailService();
this.rentalFlow = new RentalFlowEmailService();
this.rentalReminder = new RentalReminderEmailService();
this.userEngagement = new UserEngagementEmailService();
this.alphaInvitation = new AlphaInvitationEmailService();
this.initialized = false;
}
/**
* Initialize all email services
* @returns {Promise<void>}
*/
async initialize() {
if (this.initialized) return;
await Promise.all([
this.auth.initialize(),
this.feedback.initialize(),
this.forum.initialize(),
this.messaging.initialize(),
this.customerService.initialize(),
this.rentalFlow.initialize(),
this.rentalReminder.initialize(),
this.userEngagement.initialize(),
this.alphaInvitation.initialize(),
]);
this.initialized = true;
console.log("All Email Services initialized successfully");
}
}
// Create and export singleton instance
const emailServices = new EmailServices();
module.exports = emailServices;