chore: push notification test
This commit is contained in:
@@ -7,6 +7,7 @@ import { firstValueFrom } from "rxjs";
|
||||
import { MailboxResolverService } from "./mailbox-resolver.service";
|
||||
import { MailServerService } from "../../mail-server/services/mail-server.service";
|
||||
import { MailboxEnum } from "../../mailbox/enums/mailbox.enum";
|
||||
import { NotificationQueue } from "../../notifications/queue/notification.queue";
|
||||
import { User } from "../../users/entities/user.entity";
|
||||
import { EMAIL_QUEUE_CONSTANTS } from "../constants/email-events.constant";
|
||||
import { EmailGateway } from "../gateways/email.gateway";
|
||||
@@ -23,6 +24,7 @@ export class EmailMonitoringService implements OnModuleInit {
|
||||
private readonly emailGateway: EmailGateway,
|
||||
private readonly mailboxResolver: MailboxResolverService,
|
||||
private readonly mailServerService: MailServerService,
|
||||
private readonly notificationQueue: NotificationQueue,
|
||||
private readonly em: EntityManager,
|
||||
) {}
|
||||
|
||||
@@ -219,6 +221,11 @@ export class EmailMonitoringService implements OnModuleInit {
|
||||
timestamp: message.timestamp,
|
||||
};
|
||||
|
||||
await this.notificationQueue.addNewEmailNotification(userId, {
|
||||
fromEmail: message.from[0].address,
|
||||
fromName: message.from[0].name,
|
||||
});
|
||||
|
||||
await this.emailGateway.notifyNewEmail(userId, emailPayload);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error processing new email message for user ${userId}:`, error);
|
||||
|
||||
Reference in New Issue
Block a user