2022-08-08 04:42:08 -04:00
|
|
|
import { Job } from 'bullmq'
|
2021-08-27 08:32:44 -04:00
|
|
|
import { EmailPayload } from '@shared/models'
|
2018-01-30 07:27:07 -05:00
|
|
|
import { logger } from '../../../helpers/logger'
|
2020-04-23 03:32:53 -04:00
|
|
|
import { Emailer } from '../../emailer'
|
2018-01-30 07:27:07 -05:00
|
|
|
|
2021-08-27 08:32:44 -04:00
|
|
|
async function processEmail (job: Job) {
|
2018-01-30 07:27:07 -05:00
|
|
|
const payload = job.data as EmailPayload
|
2022-08-08 09:48:17 -04:00
|
|
|
logger.info('Processing email in job %s.', job.id)
|
2018-01-30 07:27:07 -05:00
|
|
|
|
2019-02-14 05:56:23 -05:00
|
|
|
return Emailer.Instance.sendMail(payload)
|
2018-01-30 07:27:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
processEmail
|
|
|
|
}
|