mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { Scope } from '@nestjs/common';
|
||||
import { Job } from 'bullmq';
|
||||
import { Process } from '@nestjs/bull';
|
||||
import { Processor, WorkerHost } from '@nestjs/bullmq';
|
||||
import {
|
||||
SendSignupVerificationMailJob,
|
||||
SendSignupVerificationMailQueue,
|
||||
} from '../Auth.constants';
|
||||
import { MailTransporter } from '@/modules/Mail/MailTransporter.service';
|
||||
import { AuthenticationMailMesssages } from '../AuthMailMessages.esrvice';
|
||||
|
||||
@Processor({
|
||||
name: SendSignupVerificationMailQueue,
|
||||
scope: Scope.REQUEST,
|
||||
})
|
||||
export class SendSignupVerificationMailProcessor extends WorkerHost {
|
||||
constructor(
|
||||
private readonly authMailMesssages: AuthenticationMailMesssages,
|
||||
private readonly mailTransporter: MailTransporter,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
@Process(SendSignupVerificationMailJob)
|
||||
async process(job: Job<SendSignupVerificationMailJobPayload>) {
|
||||
try {
|
||||
await this.authMailMesssages.sendSignupVerificationMail(
|
||||
job.data.email,
|
||||
job.data.fullName,
|
||||
job.data.token,
|
||||
);
|
||||
} catch (error) {
|
||||
console.log('Error occured during send signup verification mail', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface SendSignupVerificationMailJobPayload {
|
||||
email: string;
|
||||
fullName: string;
|
||||
token: string;
|
||||
}
|
||||
Reference in New Issue
Block a user