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