email refactor
This commit is contained in:
58
backend/services/email/index.js
Normal file
58
backend/services/email/index.js
Normal file
@@ -0,0 +1,58 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user