// processors/mail.processor.ts
import { Process, Processor } from '@nestjs/bull';
import { Job } from 'bull';
import { MailsService } from '../services/mails.service';

@Processor('mail-queue')
export class MailProcessor {
  constructor(private readonly mailsService: MailsService) {}

  @Process('send-mail')
  async handleSendMail(job: Job) {
    const { to, subject, html } = job.data;

    await this.mailsService.sendPlainHtml(to, subject, html);
  }
}
