2018-07-10 10:02:20 -05:00
|
|
|
import * as Bull from 'bull'
|
2018-01-30 06:27:07 -06:00
|
|
|
import { logger } from '../../../helpers/logger'
|
|
|
|
import { Emailer } from '../../emailer'
|
|
|
|
|
|
|
|
export type EmailPayload = {
|
|
|
|
to: string[]
|
|
|
|
subject: string
|
|
|
|
text: string
|
2019-02-14 04:56:23 -06:00
|
|
|
|
|
|
|
fromDisplayName?: string
|
|
|
|
replyTo?: string
|
2018-01-30 06:27:07 -06:00
|
|
|
}
|
|
|
|
|
2018-07-10 10:02:20 -05:00
|
|
|
async function processEmail (job: Bull.Job) {
|
2018-01-30 06:27:07 -06:00
|
|
|
const payload = job.data as EmailPayload
|
|
|
|
logger.info('Processing email in job %d.', job.id)
|
|
|
|
|
2019-02-14 04:56:23 -06:00
|
|
|
return Emailer.Instance.sendMail(payload)
|
2018-01-30 06:27:07 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
processEmail
|
|
|
|
}
|