email.ts 478 B

123456789101112131415161718
  1. import * as Bull from 'bull'
  2. import { logger } from '../../../helpers/logger'
  3. import { Emailer, SendEmailOptions } from '../../emailer'
  4. export type EmailPayload = SendEmailOptions
  5. async function processEmail (job: Bull.Job) {
  6. const payload = job.data as EmailPayload
  7. logger.info('Processing email in job %d.', job.id)
  8. return Emailer.Instance.sendMail(payload)
  9. }
  10. // ---------------------------------------------------------------------------
  11. export {
  12. processEmail
  13. }